`app.js`

```
const adminRoutes = require('./routes/admin');
app.use('/admin/customer/:customerId', (req, res, next) => {
    console.log('middleware id=', req.params.customerId);
    next();
}, adminRoutes);

```

and here is `routes/admin.js`

```
const express = require('express');
const router = express.Router();

router.post('/user', (req, res) => {
    console.log('route id=', req.params.customerId);
    res.json(req.params);
});

module.exports = router;

```

I am getting following output 

```
middleware id= 1
route id= undefined

```

while expected output is

```
middleware id= 1
route id= 1

```