In order to use the project:
- Clone the repository
git clone https://github.com/deltorosalazar/node-rest-shop.git
- Install the dependencies
npm install
- Run the project
npm run start
- Fix the code using StandardJS rules
npm run start
- The server will be running in the port 3002
- To test the API, use Postman
- Some routes are protected, so you have to register and log in first:
Endpoint | Method | Body |
---|---|---|
http://localhost:3002/users/signup |
POST | { "email": "test@gmail.com", "password": "password" } |
http://localhost:3002/users/login |
POST | { "email": "test@gmail.com", "password": "password" } |
http://localhost:3002/users/ |
GET | |
http://localhost:3002/users/id |
DELETE | |
http://localhost:3002/products |
GET | |
http://localhost:3002/products/ |
POST | { "name": "Product", "price": "2000", "token": "XXXX" } |
http://localhost:3002/products/id |
DELETE | { "token": "XXXX" } |
http://localhost:3002/products |
PUT | { "email": "test@gmail.com", "password": "password" } |
The bold endpoints need a token that is generated when the user logs in.