vendi-man
is RESTful APIs for a vending machine which allow users to sell and buy products.
- Node.js
- Express.js
- React.js
- TypeScript
- MongoDB
- Mongoose
- Axios
- Node.js 16+
- Local MongoDB
- Clone https://github.com/sprakash57/vendi-man and cd into
vendi-man/server
- Use
.env.example
to create your own.env
file. - Install dependencies:
npm install
- Run application:
npm run dev
. Base url ishttp://localhost:4000/api/v1
- To run the client, cd into
vendi-man/client
and runnpm install
. After the dependencies have been installed runnpm start
to boot the application.
- cd into
vendi-man/server
- Run
npm run dev
to spin up local - Run
npm run test
to run all the test cases.
Import Vendi-Man.postman_collection.json
to your postman.
Endpoint | Method | Description |
---|---|---|
/ |
GET | Health check |
/users |
GET | Get user details |
/users |
POST | Create a new user |
/users |
DELETE | Delete user details |
/users/deposit |
POST | Add deposit amount |
/users/deposit/reset |
DELETE | Reset deposit amount |
/sessions |
GET | Get session details |
/sessions |
POST | Create a new session |
/sessions/refresh |
POST | Get access token |
/sessions/logout |
DELETE | Delete current session |
/sessions/logout/all |
DELETE | Delete all sessions |
/products |
GET | Get all products |
/products/:productId |
GET | Get product details |
/products |
POST | Add new product |
/products/:productId/buy |
POST | Buy a product |
/products/:productId |
PUT | Update product details |
/products/:productId |
DELETE | Delete product |
Whitelist urls to avoid CORS issueInclude Content Security Policy- Add filter by seller name feature and can be triggered by a toggle button on client
- Store list of transactions for buyers and sellers