Add getSingleProduct and getAllProducts functions.
Related Ticket(s)
This deals with two functions of the model part of Issue #54 (Create Product MVC).
Expected Behavior
When you call getSingleProduct(product_id) it will return a single product object. When you call getAllProducts, it will return an array of all products.
Steps to Test Solution
Comment out all routes other than the products route.
In the project folder, run: nodemon app.js
To test get individual product In your browser, access: http://localhost:[YOUR PORT]/api/v1/products/5
To test get all products In your browser, access: http://localhost:[YOUR PORT]/api/v1/products
Description
Add getSingleProduct and getAllProducts functions.
Related Ticket(s)
This deals with two functions of the model part of Issue #54 (Create Product MVC).
Expected Behavior
When you call getSingleProduct(product_id) it will return a single product object. When you call getAllProducts, it will return an array of all products.
Steps to Test Solution
nodemon app.js
http://localhost:[YOUR PORT]/api/v1/products/5
http://localhost:[YOUR PORT]/api/v1/products