This is an E-commerce API made using Node.Js & MongoDB.
- run "npm init" command on terminal in this projects directory
- start the server using node index.js
- Open postman
- Make a GET request on localhost:5500/products
- The products should be visible
- start the server using node app.js
- Open postman
- put localhost:5500/products/create as the url.
- Select Body tab below the url textarea and then select x-www-form-urlencoded
- Add name & quantity as the keys and set the desired values for the keys.
- Make a POST request.
- If you recieve the message saying new product added successfully then you have done everything correct.
- The product is created. Check it out by making a GET request at localhost:5500/products or refresh the browser.
- Copy the object id of the product you want to delete.
- add the id after localhost:5500/products/ on the Postman.
- Make a DELETE request.
- You will recieve a message saying deleted successfully.
- Then go on the browser refresh the browser and see in the browser which id give on the postman is deleted.
- Copy the object id of the product whose quantity you want to update
- Put the id after localhost:5500/products/
- After putting the id add /update_quantity/?number={x} in the url where x is the number by which you want to increase or decrease the quantity.
- the url should be looking like localhost:3000/products/{id}/update_quantity/?number={x}
- Make a POST request and you should get a message containing the update product
Node.Js, MongoDB