stacked

bundle multiple middleware functions into one stack

npm install stacked
1 downloads in the last day
8 downloads in the last week
52 downloads in the last month

stacked

Stacked is a stand-alone, lightweight, zero-dependency version of connect's middleware infrastructure.

It can be used to create modules that bundle multiple middleware functions into one.

Usage

var stacked = require('stacked')

/**
 * A middleware that logs the requested URL.
 */
function middleware(req, res, next) {
  console.log('url:', req.url)
  next()
}

/**
 * A middleware that logs the requested URL (with the mount point stripped)
 * as well as the original URL.
 */
function mounted(req, res, next) {
  console.log('url:', req.url, 'realUrl:', req.realUrl)
  next()
}

module.exports = stacked()
  .use(middleware)
  .mount('/path', mounted)
npm loves you