Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/altipla-consulting/express-async-handler
- Owner: altipla-consulting
- License: mit
- Created: 2023-04-03T13:17:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T07:58:29.000Z (over 1 year ago)
- Last Synced: 2024-12-08T11:07:35.298Z (about 1 month ago)
- Topics: express, expressjs, nodejs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@altipla/express-async-handler
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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))
```