This is probably basic JS stuff but please what is the difference between
app.get("/api/products/1", (req, res) => {
const singleProduct = products.find((product) => {
product.id === 1;
});
res.json(singleProduct);
});
AND
app.get("/api/products/1", (req, res) => {
const singleProduct = products.find((product) => product.id === 1);
res.json(singleProduct);
});
They look the same to me, the former is me trying to code ahead of the instructor and I was not getting any JSON response on the browser, while the latter is the instructor's code which he got the JSON response