screenshot has been provided in asset/images folder
This is an E-commerce API made using tech-stack Node.Js & MongoDB.
USING THE API:
- clone or download & extract zip folder & open with editor
- run npm init in the Ecommerce_API folder on terminal, make sure NodeJS server is running
- run npm install
- run npm start
- open postman & make GET request on http://localhost:3000/products
- may need to create some products 1st
CREATING A NEW PRODUCT:
- Open postman
- POST request, http://localhost:3000/products/create
- Select Body tab below the url textarea and then select x-www-form-urlencoded
- Add name(product1) & quantity(10) as the keys and set the desired values for the keys.
- Message saying New product created successfully.
- Product is created, validate it using GET request, http://localhost:3000/products
DELETING A PRODUCT:
- Copy the object id of the product you want to delete.
- add the id after products/, http://localhost:3000/products/6427c96a812c48062a222efb
- Make a DELETE request.
- Message saying Product deleted successfully.
UPDATING THE QUANTITY OF A PRODUCT:
- Copy the object id of the product whose quantity you want to update
- Put the id after products/
- After putting the id add /update_quantity/?number={x}, x is quantity via which value will be updated (+/-)
- the url, http://localhost:3000/products/64227a12abef9cb0ea86de17/update_quantity?number=10
- Make a POST request and you should get a message updated successfully & produc description