1] Create a mongodb database locally named mydatabase
.
2] Create a collection named "products" in the database.
3] Each document in the "products" collection should have fields: _id (automatically generated by MongoDB), name, description, and price
1] First run npm install
in terminal.
2] Then run npm start
.
3] Api can be checked on POSTMAN by running following API endpoints.
1] Retrieve all products - http://localhost:3000/products
(GET method).
2] Retrieve a single product by ID - http://localhost:3000/products/:id
(GET method).
3] Update the price of a product by ID - http://localhost:3000/products/:id
(PUT method).