express-param-capture
v1.0.0
Published
process request parameters with regexp
Downloads
1
Readme
express-param-capture
Process request parameters with regexp and use the resulting capturing group in the routes.
like express-params but works
properly in recent express releases where the use of app.param(fun)
has been
deprecated.
Usage
app = express()
capture = require('express-param-capture')
app.param('locale', capture(/([a-z]{2})_([A-Z]{2})/));
app.get('/:locale', function (req, res) {
res.status(200).send(req.params.locale[1] + ' - ' + req.params.locale[2]);
});