A basic Vending machine backend server in TypeScript
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
- The endpoints exposed can be interacted with as a regular user and a maintainer
- Request Method: GET
$ /api/v1/users/products
- Request Method: POST
$ /api/v1/users/products
Sample payload = {
"slot": 3,
"quantity": 1,
"price": [2,2,1,3]
}
Where the array of price
being passed represents the following,
- Number of 5 cents coins
- Number of 10 cents coins
- Number of 25 cents coins
- Number of 50 cents coins
- Request Method: POST
$ /api/v1/maintainer/products
Sample Payload = {
"slot": 4,
"name": "Biscuit",
"quantity": 40,
"price": 15
}
- Request Method: PUT
$ /api/v1/maintainer/products/:slot
Sample Payload = {
"price": 50,
"quantity": 100
}
- Request Method: GET
$ /api/v1/maintainer/coins
- Request Method: POST
$ /api/v1/maintainer/coins
Sample Payload = {
"coins": [2,2,1,3]
}
Where coins
passed are represented in the following format,
- Number of 5 cents coins
- Number of 10 cents coins
- Number of 25 cents coins
- Number of 50 cents coins
- Author - Ifeanyichukwu Amajuoyi
- Email - [[email protected]]