🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

async-middleware

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-middleware

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

1.2.0
Version published
Weekly downloads
3.1K
-28.66%
Maintainers
1
Weekly downloads
 
Created

Async Middleware

NPM version NPM downloads Build status Test coverage 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

FAQs

Package last updated on 28 Jun 2017

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