An API returning Pokemon information by name.
Featuring an endpoint which returns a funny version of the Pokemon description.
Check the online OpenApi documentation https://fun-pokedex.herokuapp.com/swagger-ui.html.
You can use it to make API calls directly form the browser.
The easiest way to get started is to use Docker, as you won't have to configure your local Java environment. Download and install Docker here https://docs.docker.com/desktop/ if you do not have it already.
Also make sure you have git installed. If you don't, follow the instructions for your platform at https://git-scm.com/download.
Click the image below to watch the screen recoding:
- From the terminal, cd to your favorite project directory, and run the following
git clone [email protected]:nico-incubiq/pokedex.git
- From the directory where you checked-out the codebase, run the following command in the terminal
docker build --tag fun-pokedex .
- Run the following command in the terminal to run the app locally on port 80
docker run --detach --publish 80:8080 --name running-fun-pokedex fun-pokedex
- You can check the application is running and healthy using the below command.
As soon as it displays
(healthy)
, you know the app is running.
docker container ls
- You can also check the logs of the application with this command
docker logs -f running-fun-pokedex
- Open your favorite browser at http://localhost/swagger-ui.html to start using the app
- Or test from the terminal with
curl
andjq
(if you have them)
curl -s http://localhost/pokemon/mewtwo | jq
- Stop and remove the container
docker container rm --force running-fun-pokedex
- There is realistically not that many Pokemons out there, it would be more efficient to just download the full list and store it locally in a file in the project. Gotta Cach'Em All!
- Same thing for the description transformations, this is a static operation that will never change at runtime either, so it could be computed in advance and stored in a file.
- If storage in a static file is not acceptable, we could implement a simple cache, either
by deploying an additional Redis / Memcached server, or by using a
WeakHashMap
.
- Add rate limiting; even more considering we are hitting external downstream services; it would be considerate.
- FunTranslations has a paid plan which lifts the rate limiting, this would be to consider for production.
- Implement the circuit breaker pattern to alleviate the negative impact of downstream APIs being down.