New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

express-enum-param

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-enum-param

Middleware for ensuring that a request parameter can only assume certain values

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

express-enum-param

Middleware for ensuring that a request parameter can only assume certain values

Installation

$ npm install --save express-enum-param

Requires body-parser.

Usage

import enumParam from 'express-enum-param';

let allowedAnimals = ['crocodile', 'heron', 'turtle'];

router.get('/', 
	enumParam('animal', allowedAnimals),
	(req, res) => {
    res.status(200).send();
});

The above code will return a 400 HTTP status code and a message informing the client that this parameter can only have values from a certain list if animal is anything else than crocodile, heron, or turtle.

About

License

Copyright © 2018, nukeop. Released under the Affero GPL 3.0 License.

Keywords

express

FAQs

Package last updated on 13 Dec 2018

Did you know?

Socket

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