1 - Clone repository from github
$ git clone https://github.com/wescleysrn/pokemon-server.git
2 - Access the project
$ cd pokemon-server
3 - Install libraries and dependencies
$ mvn clean package
4 - Run the project
$ mvnw spring-boot:run
5 - Test API
http://localhost:8080/swagger-ui/index.html
Java project aimed at providing the features of the Pokemon challenge.
The project was created using the Start Spring Initializr, Maven project and added web dependency, Swagger was not included for API documentation, Log, etc as it exceeded the scope of the challenge.
Resources such as stream, spring test using hamcrest as validator were used, controllers and mediators were covered. Spring http from spring web was used generating api returns via HttpEntity, MessageConverters customization was avoided by creating a DTO structure with a subclass equal to the API return.
To simulate the API, you can use API calls via the browser or, after running the Java project, run the Angular web project and use the Backend API Menu option.
The solution allows you to enter the name of a city and based on that city, the weather API is consumed, which searches for the current temperature, if it is raining at the moment, etc.
According to the weather of the city, the Pokemon API is consumed to display the image of a Pokemon of a type according to the weather.
It is possible to load other Pokemons of the same type or clear the data that was loaded for a new query.
Two solutions were created, a frontend and a backend, and to work the API search by the backend it is necessary to run the pokemon-server project in Java.
The solution is also responsive and has all developer data.
To start the project was used Spring Initializr:
https://start.spring.io/
Projet: Maven Project
Language: Java
Spring Boot: 2.6.4
Metadata
Group: br.com.pokemon
Artifact: pokemon-server
Name: Pokemon Server
Description: Project backend of the Code Challenge Pokemon
Package Name: br.com.pokemon
Packaging: jar
Java: 8
Dependencies:
- Spring Web
First packages install
mvn clean package
Run the project
.\mvnw spring-boot:run
br.com.pokemon.dto
CityWeatherDTO
PokemonDTO
PokemonDetailDTO
br.com.pokemon.mediator
OpenWeatherMediator
PokemonMediator
br.com.pokemon.rest
OpenWeatherRest
PokemonRest