Get Product by ID
Masih dalam file product.js, isi script berikut dibwah fungsi Get All Product
// folder-project/routes/product.js
app.get('/product/:id', (req, res) => {
Product.findOne({
where: {
id: req.params.id
}
}).then(product => {
if(!product) {
return res.json({data: "Not found"})
}
res.json(product)
})