# @cdellacqua/express-async-wrapper

> Enable support for async syntactic sugar in express middlewares and request handlers

Latest version **1.0.7** (published 2023-03-16) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-03-16 |
| First published | 2020-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Carlo Dell'Acqua |
| Maintainers | cdellacqua |
| Keywords | express, async |

## Links

- npm: https://www.npmjs.com/package/@cdellacqua/express-async-wrapper
- Repository: https://github.com/cdellacqua/express-async-wrapper
- Issues: https://github.com/cdellacqua/express-async-wrapper/issues
- npm.io page: https://npm.io/package/@cdellacqua/express-async-wrapper

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@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

## Recent versions

- 1.0.7 (latest) — 2023-03-16
- 1.0.6 — 2021-08-07
- 1.0.5 — 2021-08-07
- 1.0.4 — 2021-08-07
- 1.0.3 — 2021-08-07
- 1.0.2 — 2020-10-08
- 1.0.1 — 2020-09-28
- 1.0.0 — 2020-09-28

## README

# express-async-wrapper

Enable support for async syntactic sugar in express middlewares and request handlers


[NPM Package](https://www.npmjs.com/package/@cdellacqua/express-async-wrapper)

`npm install @cdellacqua/express-async-wrapper`

## How To

Whenever an awaited promise rejects, the asyncWrapper will handle the exception passing it to the next available middleware

```
import { asyncWrapper } from '@cdellacqua/express-async-wrapper';

router.get('/example', asyncWrapper(async (req, res) => {
	await somethingThatReturnsAPromise();
	res.send('done');
}));
```

```
import { asyncWrapper } from '@cdellacqua/express-async-wrapper';

app.use(asyncWrapper(async (req, res, next) => {
	await somethingThatReturnsAPromise();
	next();
}));
```

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