Hi everyone. It says Since req.params.id is '1’. Why so? Why is it one?
'1' because of the URL of the PUT request and because of the route specified in the call to
In this case, the example request provided is:
PUT /monsters/1?name=chimera&age=1. Express matches up this request with your route
'/monsters/:id' and does some parsing of the URL because of the included
Anything after the
? in the URL is accessed through
req.query so we can ignore
?name=chimera&age=1 for now.
If your route had been
'/monsters/:monsterId' then you’d still be able to access the
Oh, didn’t see that number 1 in the path. Thanks.
Can you please remind me how we style text here so it looks like code?
Sure, you can use this option in the style bar:
That’s really just a shortcut to adding a block of backticks