Roulette Rest API built using TypeScript and Redis.
To build the Docker image, use the docker build
command:
docker build . -t roulette:latest -f Dockerfile.api
To stop the build on a specific stage, use the target
option:
docker build --target builder -t roulette:latest . -f Dockerfile.api
For development, use the docker-compose up -d
command:
docker-compose up -d
- All endpoints return either a JSON object or array.
- For POST and PUT endpoints, the content to save is specified in the body request with Content-Type x-www-form-urlencoded or application/json.
POST /roulettes
You can use the following mime types in your Content-Type header and provide the data in the body:
- x-www-form-urlencoded (key par value).
- application/json (json).
Parameter | Type | Mandatory | Description |
---|---|---|---|
Values | Key-par or JSON | Yes | Values to save in DB |
The schema is defined as follow. All the properties are required.
name: String
{
"id": "307770a0-a542-11ea-bf59-d599c4ac862e",
"isOpen": false,
"name": "Sala1"
}
PUT /roulettes/open/:id
{
"id": "307770a0-a542-11ea-bf59-d599c4ac862e",
"isOpen": false,
"name": "Sala1"
}
PUT /roulettes/close/:id
{
"result": "32",
"roulette": {
"id": "7ac43170-1333-11eb-8f2d-b937f300a09f",
"isOpen": false,
"name": "Casino Royale 007"
},
"betWinners": [],
"betLosers": [
{
"id": "8b6b3190-1333-11eb-8f2d-b937f300a09f",
"rouletteId": "7ac43170-1333-11eb-8f2d-b937f300a09f",
"amount": 1000,
"selection": "BLACK",
"userId": "20ed3270-a603-11ea-a08a-315bb84a695d"
}
]
}
GET /roulettes
POST /bets
You can use the following mime types in your Content-Type header and provide the data in the body:
- x-www-form-urlencoded (key par value).
- application/json (json).
Parameter | Type | Mandatory | Description |
---|---|---|---|
Values | Key-par or JSON | Yes | Values to save in DB |
USER | HEADER | Yes | User UUID |
The schema is defined as follow. All the properties are required.
selection: String
rouletteId: String (UUID)
amount: Number
{
"id": "dc664320-a608-11ea-aace-d1ab6ba55deb",
"rouletteId": "20ed3270-a603-11ea-a08a-315bb84a695d",
"amount": 1000,
"selection": "BLACK",
"userId": "20ed3270-a603-11ea-a08a-315bb84a695d"
}