Node.js · Junior · Question 63 of 75

How do you read 42 from the URL /users/42 in Express?

app.get("/users/:id", (req, res) => {
  // ?
});

Explanation

Route parameters are in req.params and are strings. Query strings like /users?page=2 are in req.query.

Further reading

Problem with a question

Node.js · Junior · question 63

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz