express-param-capture

1.0.0 • Public • Published

express-param-capture

NPM Version Build Status Coverage Status

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]);
});

Readme

Keywords

none

Package Sidebar

Install

npm i express-param-capture

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • keis