Express 5 · Routing

Read a route parameter

Capture part of the URL as a parameter.

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

Official Express 5 documentation

More routing commands

All routing commands · Express 5 cheatsheet

Was this page helpful?