Nest API simulatting an online roulette's behavior.
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Send a POST
request to /roulettes
.
- Response's body:
{
"rouletteId": "2dd6119c-f8ed-4a35-b073-9b407b32314d"
}
Send a PATCH
request to /roulettes/:id
.
- Response's body:
{
"status": "success"
}
Send a POST
request to /roulettes/:id/bets
.
-
Request's headers:
X-USER-ID
: string with the user's id.
-
Request's body:
{
"type": "number",
"number": 36,
"amount": 8500
}
Send a PATCH
request to /roulettes/:id/close
.
- Response's body:
{
"color": "red",
"number": 24,
"gamblers": [
{
"userId": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"betType": "color",
"hasWon": true,
"amount": 15480
},
{
"userId": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"betType": "number",
"hasWon": true,
"amount": 43000
},
{
"userId": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"betType": "number",
"hasWon": false,
"amount": 8600
},
{
"userId": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"betType": "color",
"hasWon": true,
"amount": 15480
}
]
}
Send a GET
request to /roulettes
.
- Response's body:
{
"roulettes": [
{
"id": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"status": "open"
},
{
"id": "2dd6119c-f8ed-4a35-b073-9b407b32314d",
"status": "closed"
}
]
}
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov