Socket
Socket
Sign inDemoInstall

express-request-checker

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-request-checker

Express request checker extension.


Version published
Maintainers
1
Created

Readme

Source

express-request-checker

Create request checker middleware with options for Express.

Example(Javascript):

var express = require('express');
var router = express.Router();
var reqChecker = require('express-request-checker')

var options = {
  scope: 'query', // Check scope. ('query'|'body', DEFAULT: 'query')
  strict: false,  // Allow unexpected parameter. (true|false, DEFAULT: true)
  params: {       // Paramters.
    'param1': {
      matchRegExp: /^[0-9]{1}$/
    },
    'param2': {
      matchRegExp: /^[0-9]{2}$/,
      isOptional: true    // Optional parameter. (true|false, DEFAULT: false)
    }
  }
};
router.get('/path', reqChecker(options), handlerFunction);

Example(CoffeeScript):

options =
  scope: 'query' # Check scope. ('query'|'body', DEFAULT: 'query')
  strict: false  # Allow unexpected parameter. (true|false, DEFAULT: true)
  params:        # Paramters.
    'param1':
      matchRegExp:/^[0-9]{1}$/
    'param2':
      matchRegExp:/^[0-9]{2}$/
      isOptional:true    # Optional parameter. (true|false, DEFAULT: false)
router.get '/path', reqChecker(options), handlerFunction

Keywords

FAQs

Last updated on 28 Jan 2015

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