node package manager

compose-middleware

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) {}
]))

License

MIT