async-middleware

Wrap an asynchronous middleware (or handler) function for Express, Connect, router, etc.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
async-middleware
4821.2.15 years ago7 years agoMinified + gzip package size for async-middleware in KB

Readme

Async Middleware
!NPM versionnpm-imagenpm-url !NPM downloadsdownloads-imagedownloads-url !Build statustravis-imagetravis-url !Test coveragecoveralls-imagecoveralls-url Greenkeeper badge
Wrap an asynchronous middleware (or handler) function for Express, Connect, router, etc.

Installation

npm install async-middleware --save

Usage

Wrap a middleware function using async and/or promises to catch errors and forward them to next(err).
var express = require('express')
var wrap = require('async-middleware').wrap

var app = express()

app.use(wrap(function (req, res) {
  return Promise.reject(new Error('boom!'))
}))

License

MIT