A simple REST API project π
It manipulates a fake business model with Users, Products and Orders.
Built withΒ Β Β |Β Β Β API RoutesΒ Β Β |Β Β Β How to start
- Express
- Mongoose
| Route | Method | Description |
|---|---|---|
| /users | POST | Create a new user |
| /users/authenticate | POST | Authenticate a user (Used for login, it returns a session token) |
| /users/refresh-token | POST | Generate a new token |
| Route | Method | Description |
|---|---|---|
| /products | GET | List all active products |
| /products | POST | Create a new product |
| /products | DELETE | Delete a product |
| /products/:slug | GET | Return a product by its slug |
| /products/:id | GET | Return a product by its id |
| /products/:id | PUT | Update a product |
| /products/tags/:tag | PUT | Return all products with a given tag |
| Route | Method | Description |
|---|---|---|
| /orders | GET | List all created orders |
| /orders | POST | Create a new order |
- Add a config.js file at src/ with the following content:
global.SALT_KEY = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; // Salt key to enhance password security
module.exports = {
connectiongString: 'xxxxxx', // DB connectiongString
sendgridKey: 'xxxxxx', // SendGrid key
}- Install the dependencies and start the app
npm install && npm start