16
Fri Oct 28 2022 08:52:00 GMT+0000 (Coordinated Universal Time)
Saved by
@Vrushabh_123
router.route('/:productId').get(async (req, res) => {
try {
const product = await Product.findById(id)
if (!product) {
return res
.status(400)
.json({ success: false, message: 'product not found' })
}
res.json({ product })
} catch {
res
.status(400)
.json({ success: false, message: 'could not retrieve product ' })
}
})
content_copyCOPY
Comments