🐅 A simple API REST pokemon battle.
- NodeJs 12.x
$ git clone https://github.com/gabriel-roque/pokemon-api
$ cp .env.example .env
APP_URL=
DB_DIALECT=
DB_HOST=
DB_USERNAME=
DB_PASSWORD=
DB_NAME=
DB_NAME_SCHEMA=
$ sequelize db:migrate
$ npm run dev
or
$ npm start
Check in development at http://localhost:3333/v1/api/
Check in production at https://pokemon-api-challanger.herokuapp.com/v1/api
✅ GET /v1/api/pokemons
↩ Response HTTP Code 200 - OK
[
{
"id": 1,
"tipo": "pikachu",
"treinador": "Gabriel",
"nivel": 12
}, {
"id": 2,
"tipo": "charizard",
"treinador": "Anderson",
"nivel": 11
}
]
✅ POST /v1/api/pokemons
➡ Request
Attribute | Type |
---|---|
tipo | String [mewtwo / charizard / pikachu] |
treinador | String |
{
"tipo": "pikachu",
"treinador": "Gabriel",
}
↩ Response HTTP Code 200 - OK
{
"id": 1,
"tipo": "pikachu",
"treinador": "Gabriel",
"nivel": 12
},
✅ PUT /v1/api/pokemons/:id
➡ Request
Attribute | Type |
---|---|
treinador | String |
{
"treinador": "Anderson",
}
↩ Response HTTP Code 204 - No Content
✅ DELETE /v1/api/pokemons/:id
↩ Response HTTP Code 204 - No Content
✅ POST /v1/api/batalhar/:pokemonAId/:pokemonBId
↩ Response HTTP Code 200 - OK
{
"vencedor": {
"id": 1,
"tipo": "pikachu",
"treinador": "Anderson",
"nivel": 2
},
"perdedor": {
"id": 2,
"tipo": "charizard",
"treinador": "Gabriel",
"nivel": 0
}
}
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!