Complete the code to access the route parameter 'id' using req.params.
app.get('/user/:id', (req, res) => { const userId = req.params.[1]; res.send(`User ID is ${userId}`); });
The route parameter 'id' is accessed via req.params.id.
Complete the code to define a route that captures a 'postId' parameter.
app.get('/posts/:[1]', (req, res) => { res.send(`Post ID: ${req.params.postId}`); });
The route parameter name must match the key used in req.params. Here, 'postId' is used.
Fix the error in accessing the 'category' parameter from the route.
app.get('/items/:category', (req, res) => { const cat = req.[1].category; res.send(`Category: ${cat}`); });
Route parameters are accessed via req.params, not req.body or others.
Fill both blanks to create a route that captures 'userId' and 'postId' parameters and sends them back.
app.get('/users/:[1]/posts/:[2]', (req, res) => { res.send(`User: ${req.params.userId}, Post: ${req.params.postId}`); });
The route path must define both parameters with the exact names used in req.params.
Fill all three blanks to create a route with parameters 'category', 'id', and 'action' and send a response using them.
app.get('/:[1]/:[2]/:[3]', (req, res) => { res.send(`Category: ${req.params.category}, ID: ${req.params.id}, Action: ${req.params.action}`); });
The route path must define parameters 'category', 'id', and 'action' matching the keys in req.params.