I am trying to use the following code to get Id in the url. The problem is that req.params is not giving anything from the route.
app.get("/getAllParcels/:Id",(req,res) => {
custId = req.params.Id;
res.send('this is parcel with id:', custId);
});
The Express version of
res.send(), only takes one argument so when you do this:it's only going to do this (only paying attention to the first argument):
Instead, change your code to this:
Note, this properly declares the variable
custIdusingconstand it uses a template string (with backquotes) to efficiently incorporate thecustId.