express-params-handler
Express.js params handler
Last updated 22 days ago by alexandria .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install express-params-handler 
SYNC missed versions from official npm registry.

express-params-handler Build Status

Express.js v4+ params handler

This lib is replacement of express-params which is made for Express 2.5. Express v4+ deprecated number of features which are in use of that original library. This lib offers similar functionality but doesn't use deprecated methods of new Express.

Installation

npm i express-params-handler

Usage

var expressParams = require('express-params-handler')

var app = express()

app.param('id', expressParams(Number))
app.param('date', expressParams(/^\d{4}-\d{2}-\d{2}$/))

app.get('/by-id/:id', function(req, res, next) {
  // req.params.id will be a number
})

app.get('/by-date/:date', function(req, res, next) {
  // req.params.date will be a string with YYYY-MM-DD format
})

Licence

MIT

Current Tags

  • 1.0.0                                ...           latest (22 days ago)

5 Versions

  • 1.0.0                                ...           22 days ago
  • 0.2.1                                ...           22 days ago
  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 22
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |