# async-middleware

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

Latest version **1.2.1** (published 2017-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-middleware
pnpm add async-middleware
yarn add async-middleware
bun add async-middleware
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2017-07-07 |
| First published | 2016-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | middleware, express, async, promise, handler |

## Links

- npm: https://www.npmjs.com/package/async-middleware
- Repository: https://github.com/blakeembrey/async-middleware
- Issues: https://github.com/blakeembrey/async-middleware/issues
- npm.io page: https://npm.io/package/async-middleware

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2017-07-07
- 1.2.0 — 2017-06-28
- 1.1.0 — 2017-04-05
- 1.0.2 — 2017-03-18
- 1.0.1 — 2016-06-20
- 1.0.0 — 2016-05-04

## README

# Async Middleware

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Greenkeeper badge](https://badges.greenkeeper.io/blakeembrey/async-middleware.svg)](https://greenkeeper.io/)

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

## Installation

```sh
npm install async-middleware --save
```

## Usage

Wrap a middleware function using `async` and/or promises to catch errors and forward them to `next(err)`.

```js
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

[npm-image]: https://img.shields.io/npm/v/async-middleware.svg?style=flat
[npm-url]: https://npmjs.org/package/async-middleware
[downloads-image]: https://img.shields.io/npm/dm/async-middleware.svg?style=flat
[downloads-url]: https://npmjs.org/package/async-middleware
[travis-image]: https://img.shields.io/travis/blakeembrey/async-middleware.svg?style=flat
[travis-url]: https://travis-ci.org/blakeembrey/async-middleware
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/async-middleware.svg?style=flat
[coveralls-url]: https://coveralls.io/r/blakeembrey/async-middleware?branch=master

---
_Source: https://npm.io/package/async-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
