visionmedia/express — Issue #1041: Router: Getting params object before handing request over to functions
Author: taris
Created: 2012-03-09 15:27:11+00:00
State: open

Hi there..

my application is pushing a request through some common middlewares before actually handing it over to the router and matching the route.
The routes are containing parameter like ":test" and i need some of those values in a common middleware (ACL).

Is there a way to use the buildin function of the router that fills the parameter object to get them up front and outside of the target function of the router?

Something like:

```javascript
var app = express.createServer();

app.use(function (req, res, next) {
console.log("Name:"+app.getParams(req.url).name);
next();
});

app.get('/hello/:name', function(req, res){
res.send('Hello '+req.params.name);
});
```