# Route Parameters — Express.js Fundamentals: Routing, Middleware and APIs

Source: https://www.skillbyai.com/en/expressjs/ex-route-params

> Capture dynamic URL segments with :id style route parameters and read them from req.params.

## :name syntax

A colon before a path segment, like `:id`, marks it as a parameter. Express captures it into `req.params`.

## Reading a param

`GET /users/42` gives `req.params.id === '42'` — always a string.

```javascript
app.get('/users/:id', (req, res) => {
  const { id } = req.params;
  res.json({ userId: id });
});
```

## Multiple params

A path can have several: `/users/:userId/posts/:postId` fills both `req.params.userId` and `req.params.postId`.
