https://github.com/chocoscoding/api-design-nodejs
https://github.com/chocoscoding/api-design-nodejs
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/chocoscoding/api-design-nodejs
- Owner: chocoscoding
- Created: 2022-01-10T22:51:04.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T15:30:33.000Z (over 2 years ago)
- Last Synced: 2024-04-09T21:25:04.050Z (almost 2 years ago)
- Language: TypeScript
- Size: 98.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## About
A project to learn about API designs and better api methods in NODE.JS from a course on frontend masters.
Aslo did some little tests with jest and supertest to test the api endpoints.🧪
Project was deployed on render and can be found [here](https://api-design-nodejs-zr3v.onrender.com/)
## How to use
Available routes include
- /
- /api (for accessing main api)
- /products
- /updates
- /user ( to create user)
- /signin (to sign in user)
### API ENDPOINTS
| URI | Method | Description |
| ---------------- | ------ | ----------------------------------------------------------------------------------- |
| / | GET | Welcome route |
| /user | POST | To create a new user |
| /signin | GET | To signin a user and get a bearer token |
| /api/product | GET | Get a list of products |
| /api/product/:id | GET | Get a specific product by ID |
| /api/product/:id | PUT | Update a specific product by ID |
| | | - Validates the 'name' field (must be a string) |
| /api/product | POST | Create a new product |
| | | - Validates the 'name' field (must be a string) |
| /api/product/:id | DELETE | Delete a specific product by ID |
| /api/update | GET | Get a list of updates |
| /api/update/:id | GET | Get a specific update by ID |
| /api/update/:id | PUT | Update a specific update by ID |
| | | - Validates optional 'title', 'name', 'version' fields |
| | | - Validates 'status' field (must be one of: "IN_PROGRESS", "SHIPPED", "DEPRECATED") |
| /api/update | POST | Create a new update |
| | | - Validates 'title', 'body', 'productId' fields |
| /api/update/:id | DELETE | Delete a specific update by ID |