Added controller and route for get specific product

master
parent 6debf79cdf
commit 5e332d1231

@ -374,4 +374,12 @@ exports.getCartDetails = async (req, res) => {
console.error(error); console.error(error);
res.status(500).json({ message: 'Error fetching cart details' }); res.status(500).json({ message: 'Error fetching cart details' });
} }
}; };
module.exports.getProduct = (request, response) => {
let reqParams = request.params.productId;
Course.findById(reqParams).then(result => response.send(result))
.catch(error => response.send(error));
}

@ -33,6 +33,8 @@ router.put(`/:productId/activate`, verify, verifyAdmin, productControllers.activ
// Route to create an order || check-out // Route to create an order || check-out
router.post(`/create-order`, verify, verifyNonAdmin, productControllers.createOrder); router.post(`/create-order`, verify, verifyNonAdmin, productControllers.createOrder);
// Route for getting the information of specific product
router.get("/:productId", courseController.getProduct);
// My Cart // My Cart

Loading…
Cancel
Save