# async-wrapper-express

> Express middleware to wrap async functions

Latest version **1.0.0** (published 2019-08-06) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install async-wrapper-express
pnpm add async-wrapper-express
yarn add async-wrapper-express
bun add async-wrapper-express
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-06 |
| First published | 2019-08-06 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michele Tibaldi |
| Maintainers | uwburn |

## Links

- npm: https://www.npmjs.com/package/async-wrapper-express
- Repository: https://github.com/uwburn/async-wrapper-required
- Homepage: https://github.com/uwburn/async-wrapper-required#readme
- Issues: https://github.com/uwburn/async-wrapper-required/issues
- npm.io page: https://npm.io/package/async-wrapper-express

## Recent versions

- 1.0.0 (latest) — 2019-08-06

## README

# Async wrapper middleware

A simple Express middleware to wrap async functions.

### Usage

```javascript
const express = require('express');
const asyncWrapper = require('async-wrapper-express');

const router = express.Router();

router.get('/', asyncWrapper(async function (req, res, next) {
    let objs = await getFromDb();

    res.send(objs);
}));
```

### Notes
The middleware will do Promise.resolve on the async function and then catch any error thrown, that will be then passed onto the next function in Express chain.

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