Socket
Socket
Sign inDemoInstall

express-params-handler

Package Overview
Dependencies
0
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-params-handler

Express.js params handler


Version published
Weekly downloads
2K
increased by22.87%
Maintainers
2
Install size
9.11 kB
Created
Weekly downloads
 

Readme

Source

express-params-handler

npm version 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

Keywords

FAQs

Last updated on 12 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc