Route Parameters in Express

noun

say it: “ROWT puh-RAM-uh-terz in ek-SPRES” /raʊt pəˈræmətɚz ɪn ɪkˈsprɛs/

Named parts of a route's path, such as :id, that Express captures from the URL into req.params.

What is Route Parameters in Express?

Route parameters like :id capture parts of the URL into req.params.

app.get('/recipes/:id', (req, res) => res.json(findRecipe(req.params.id)));

In a sentence

  • “Route parameters arrive as text, so "42" needs Number() before math.”
  • “In /orders/:id, the id is one of the route parameters.”

Level: Apprentice · More Node.js terms at this level

Updated