add api docs

main
Ayush Mukherjee 2 years ago
parent 6378a87375
commit 50fe913144

@ -0,0 +1,86 @@
# Mx Leaderboard API Docs
## /user
src/user/user.controller
### GET /user
Returns a list of all users as User[]
## /auth
src/auth/auth.controller
### POST /register
@Request
```json
{
"name": "user's name",
"email": "email@user.com",
"password": "user's password"
}
```
@Response
HTTP 201 Created OR HTTP 400 Bad Request
### POST /login
@Request
```json
{
"email": "email@user.com",
"password": "user's password"
}
```
@Response
```json
{
"access_token": "<authentication token generated by server>"
}
```
## /rank
src/rank/rank.controller
NOTE: @Authenticated: set authentication header with the jwt token.
### GET /
@Response
Returns the rank leaderboard as Rank[]
### GET /:userId
@Authenticated
@Response
Returns the user's current score as Rank
### GET /:userId/all
@Authenticated
@Response
Returns the user's rank history as Rank[]
### POST /add20
@Authenticated
@Response
Returns new Rank with updated score +20
### POST /add60
@Authenticated
@Response
Returns new Rank with updated score +60
### POST /add100
@Authenticated
@Response
Returns new Rank with updated score +100
Loading…
Cancel
Save