Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

warder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

warder

Lightweight request params and headers check middleware for express 4

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Warder

Lightweight request control middleware for express 4

NPM Version NPM Downloads

You can control requests headers, params and bodies easily with warder.

Getting Started

First step install module and save into your dependencies.

Install via NPM

Open terminal and write below line for installation.

npm install warder --save

After you completed install, define warder in your app.

Express Integration

You should define warder in file which handle requests.

var express = require('express');
var app = express();
var warder = require('warder');

app.get('/path', warder(controlType, paramsArray), callbackFunction)

var callbackFunction = function (req, res, next) {
   // do somethings here
}

Don't forget! Second argument must be an array.

Check Request Headers
app.get('/users', warder('headers',['token','ipAddr']), callbackFunction)
Check Request Body
app.post('/users', warder('body',['username','email']), callbackFunction)
Check Request Query Params
app.get('/search', warder('query',['q','p']), callbackFunction)

When request don't provide your requirements warder send response like below:

{
    "error": true, 
    "message": "Required fields not provided: username, password"
}

If you have an idea or find error please entry issue.

Keywords

FAQs

Package last updated on 20 Nov 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc