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

compose-middleware

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compose-middleware

Compose an array of middleware into a single function for use in Express, Connect, router, etc.

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48K
increased by11.55%
Maintainers
1
Weekly downloads
 
Created
Source

Compose Middleware

NPM version NPM downloads Build status Test coverage

Compose an array of middleware into a single function for use in Express, Connect, router, etc.

Installation

npm install compose-middleware --save

Usage

Compose multiple middleware functions into a single request middleware handler, with support for inline error handling middleware.

var express = require('express')
var compose = require('compose-middleware').compose

var app = express()

app.use(compose([
  function (req, res, next) {},
  function (err, req, res, next) {},
  function (req, res, next) {}
]))

P.S. The composed function takes three arguments. Express.js (and Connect, router) only accept error handlers of four arguments. If you want to return an error handler from compose instead, try the errors export - it works exactly the same, but exposes the four argument middleware pattern.

License

MIT

Keywords

FAQs

Package last updated on 03 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

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