This is a simple pokemon go api that allows you to create a user, login, and add pokemon to your collection.
-
Clone this repo
-
run
docker-compose up
in the root directory
-
there is a user with the email
[email protected]
and passwordadmin1234
that is an admin user -
there is about 800 pokemon in the database (same as in the excel sheet provided)
- to run the tests you cna run this command
docker-compose exec app sh
thennpm run test:cov
note go to the environment and set the URL variable to http://localhost:8080/api/v1
note you will need to create a user and login to get a TOKEN to use the other routes
the token will be assigned to the token
variable in the environment automatically when you login
-
POST /auth/signup
- body: { username: string, password: string }
- response: { token: string }
-
POST /auth/login
- body: { username: string, password: string }
- response: { token: string }
note you should be authenticated to view the pokemon routes but only admin users can add, update, and delete pokemon
- GET /pokemons
- response: { pokemon: Pokemon[] }
this endpoint will get all the pokemon in the database and its paginated it takes 5 params
+ page: number => the page number you want to get
+ pageSize: number => the number of pokemon you want to get per page
+ filters :
+ name: string => the name of the pokemon you want to filter by (string)
+ generation: number => the generation of the pokemon you want to filter by (number)
+ evolutionStage: string => the evolution stage of the pokemon you want to filter by (string)
-
POST /pokemons/add
- body: { name: string, type: string }
- response: { pokemon: Pokemon }
-
GET /pokemons/:id
- response: { pokemon: Pokemon }
note these rest of the endpoints require you to be logged in as an admin user to use them
-
DELETE /pokemons/:id (admin only)
- response: { pokemon: Pokemon }
-
PUT /pokemons/:id (admin only)
- body: { name: string, type: string }
- response: { pokemon: Pokemon }
note you will need to create a user and login to get a TOKEN to use them
-
GET /user
- response: { user: User }
-
PATCH /user
- body: { name: string, email: string }
- response: { user: User }
-
DELETE /user
- response: { user: User }
-
PATCH /user/change-password
- body: { password: string }
- response: { user: User }