I am trying to make a dynamic parameters in node js where the link /eshop/edit/1111 will take you to edit a specific product but every time i try to add a product code after the /edit/ i get TypeError: Cannot read property 'id' of undefined
this is my server code
router.get('/edit/:id', async (res, req) =>
{
let id = req.params.id;
let data = {
title: `Edit product ${code} | BuckStar`,
pageTitle: `Edit product ${code}`,
product: id
};
data.res = await results.editProduct(id, req.body.category, req.body.name, req.body.description, req.body.price, req.body.amount, req.body.amount, req.body.location);
res.render("page/create-edit", data)
});