# awrap

> async function wrapper for expressjs

Latest version **0.0.1** (published 2015-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install awrap
pnpm add awrap
yarn add awrap
bun add awrap
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-10-04 |
| First published | 2015-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tianxiang Chen |
| Maintainers | txchen |
| Keywords | async, es7, expressjs |

## Links

- npm: https://www.npmjs.com/package/awrap
- Repository: https://github.com/txchen/awrap
- Homepage: https://github.com/txchen/awrap#readme
- Issues: https://github.com/txchen/awrap/issues
- npm.io page: https://npm.io/package/awrap

## 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

- 0.0.1 (latest) — 2015-10-04

## README

# awrap - async function wrapper for express.js

express.js can take async function as middleware or handler function, however, it cannot handle the error correctly. When error happens, the request will never complete.

awrap turns async function into a normal function that express.js can accept.

## Installation

```
$ npm install awrap
```

## Usage

Just wrap the async function with awrap and pass into express:

```javascript
app.get('/', awrap(async (req, res) => {
  console.log('processing /')
  await sleep(200)
  res.send('Hello async/await!')
}))
```

## Example

[This](./example/app.es6) is an example server implementation.

To run it:

```
$ npm install
$ npm run example
```

## Changelog

**2015-10-04** `0.0.1`
First version.

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