项目作者: erdeanmich

项目描述 :
This is a small microservice which serves as a RESTful Pokedex.
高级语言: Kotlin
项目地址: git://github.com/erdeanmich/vertx-rest-pokedex.git
创建时间: 2020-09-01T16:54:07Z
项目社区:https://github.com/erdeanmich/vertx-rest-pokedex

开源协议:MIT License

下载


Vert.x REST Pokédex

This is a small microservice implementing the Pokédex of the first game generation.

Endpoints

GET: /pokedex/pokemon?name=name&type=type

This endpoint can retrieve a list of pokemon, optionally filtered by name or by type.
The response will look as follows:

  1. {
  2. "list" : [ {
  3. "id" : "001",
  4. "spriteUrls" : [ "https://img.pokemondb.net/sprites/omega-ruby-alpha-sapphire/dex/normal/bulbasaur.png", "https://img.pokemondb.net/artwork/bulbasaur.jpg", "https://img.pokemondb.net/sprites/black-white/anim/normal/bulbasaur.gif" ],
  5. "name" : "Bulbasaur",
  6. "types" : [ "Grass", "Poison" ],
  7. "total" : 318,
  8. "hp" : 45,
  9. "attack" : 49,
  10. "defense" : 49,
  11. "specialAttack" : 65,
  12. "specialDefense" : 65,
  13. "speed" : 45
  14. }, {
  15. "id" : "002",
  16. "spriteUrls" : [ "https://img.pokemondb.net/sprites/omega-ruby-alpha-sapphire/dex/normal/ivysaur.png", "https://img.pokemondb.net/artwork/ivysaur.jpg", "https://img.pokemondb.net/sprites/black-white/anim/normal/ivysaur.gif" ],
  17. "name" : "Ivysaur",
  18. "types" : [ "Grass", "Poison" ],
  19. "total" : 405,
  20. "hp" : 60,
  21. "attack" : 62,
  22. "defense" : 63,
  23. "specialAttack" : 80,
  24. "specialDefense" : 80,
  25. "speed" : 60
  26. }, {
  27. "and": "so on ..."
  28. }]
  29. }

GET: /pokedex/pokemon/:id

This endpoint fetches one specific Pokémon by id.
The response will look as follows:

  1. {
  2. "id" : "001",
  3. "spriteUrls" : [ "https://img.pokemondb.net/sprites/omega-ruby-alpha-sapphire/dex/normal/bulbasaur.png", "https://img.pokemondb.net/artwork/bulbasaur.jpg", "https://img.pokemondb.net/sprites/black-white/anim/normal/bulbasaur.gif" ],
  4. "name" : "Bulbasaur",
  5. "types" : [ "Grass", "Poison" ],
  6. "total" : 318,
  7. "hp" : 45,
  8. "attack" : 49,
  9. "defense" : 49,
  10. "specialAttack" : 65,
  11. "specialDefense" : 65,
  12. "speed" : 45
  13. }

Usage

Local

Locally you can run the service by cloning the project and running:

  1. mvn clean install vertx:run

Then you can use the endpoints under localhost:8080 .

With Docker

You can also build a docker image with:
```shell script
docker build -t erdeanmich/vertx-rest-pokedex .

  1. Afterwards you can run it with:
  2. ```shell script
  3. docker run -t -i -p 8080:8080 erdeanmich/vertx-rest-pokedex

Credits

The underlying data is a minimized version of the json file found at
José Luis Quintana’s GitHub account.
Thank you for publishing! <3