Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/altipla-consulting/express-async-handler

Transform async handlers to use them in Express v4.
https://github.com/altipla-consulting/express-async-handler

express expressjs nodejs

Last synced: 24 days ago
JSON representation

Transform async handlers to use them in Express v4.

Awesome Lists containing this project

README

        

# express-async-handler

Transform async handlers to use them in Express v4.

## Install

```sh
npm install @altipla/express-async-handler
```

## Usage

```ts
import express from 'express'
import type { Request, Response } from 'express'
import { asyncHandler } from '@altipla/express-async-handler'

async function exampleHandler(req: Request, res: Response) {
await (...)
return 'ok'
}

let app = express()
app.use('/example', asyncHandler(exampleHandler))
```