This is an api for a vending machine that allows users with the role of “seller” to add, update or remove products, while users with the role of “buyer” role can deposit coins into the machine and make purchases.
- Install Node.js, MongoDB
- Install project dependencies
- clone this repo
- update env with example.env
- run
npm run start:dev
git clone https://github.com/adeyinkaoresanya/vending-machine-api.git
npm install
npm run start:dev
Name | Type | Comments |
---|---|---|
id |
autoincrement | |
uuid |
string | |
username |
string | |
role |
string | |
password |
string | |
created_at |
timestamp | |
updated_at |
timestamp |
Name | Type | Comments |
---|---|---|
id |
autoincrement | |
uuid |
string | |
title |
string | Title of the product |
cost |
int | Price of the product |
sellerId |
string | ID of the seller who created the product |
created_at |
timestamp | |
updated_at |
timestamp | |
deleted_at |
timestamp |
Name | Type | Comments |
---|---|---|
id |
autoincrement | |
uuid |
string | |
buyerId |
string | ID of the buyer |
amount |
int | How much the product was bought for |
created_at |
timestamp | |
updated_at |
timestamp |
- Route: /api/vd/user/create
- Method: POST
- Body
{
"firstName": "Jane",
"lastName": "Bakes",
"userName": "janebakes",
"email": "[email protected]",
"password": "janebakes236"
}
Response
{"firstName":"Jane",
"lastName":"Bakes",
"userName":"janebakes",
"email":"[email protected]"}
- Route: /api/vd/user/list
- Method: GET
Response
```json
[{"firstName":"Jane",
"lastName":"Bakes",
"userName":"janebakes",
"email":"[email protected]"},
{"firstName":"John,
"lastName":"Doe",
"userName":"johndoe",
"email":"[email protected]"}]
- Route: /api/vd/user/:id
- Method: GET
Response
```json
{"firstName":"Jane",
"lastName":"Bakes",
"userName":"janebakes",
"email":"[email protected]"}
Adeyinka Oresanya