Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldimious/express-async-handler
Simple middle to handle exceptions and catch error within express routes in asynchronous and pass them to your express error handlers.
https://github.com/eldimious/express-async-handler
async-await asynchronous await error-handling error-middleware express express-error-handler express-middleware handler nodejs
Last synced: about 1 month ago
JSON representation
Simple middle to handle exceptions and catch error within express routes in asynchronous and pass them to your express error handlers.
- Host: GitHub
- URL: https://github.com/eldimious/express-async-handler
- Owner: eldimious
- License: apache-2.0
- Created: 2022-02-08T14:43:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T15:19:10.000Z (almost 3 years ago)
- Last Synced: 2024-11-18T11:25:32.994Z (about 2 months ago)
- Topics: async-await, asynchronous, await, error-handling, error-middleware, express, express-error-handler, express-middleware, handler, nodejs
- Language: TypeScript
- Homepage:
- Size: 94.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Welcome to @dimosbotsaris/express-async-handler 👋
> Simple Express.js middleware to handle exceptions and catch error within express routes in asynchronous and pass them to your express error handlers.
## Install
```sh
npm install --save @dimosbotsaris/express-async-handler
```## Usage
```ts
import express, { Request, Response, NextFunction, Router } from 'express';
import { asyncWrapper } from '@dimosbotsaris/express-async-handler';express.get('/', asyncWrapper(async (req: Request, res: Response, next: NextFunction) => {
const baz = await foo.findAll();
res.send(baz)
}))
```## Run tests
```sh
npm run test
```## Author
👤 **Dimos Botsaris**
* Website: https://www.eldimious.com
* Twitter: [@el_dimious](https://twitter.com/el_dimious)
* Github: [@eldimious](https://github.com/eldimious)
* LinkedIn: [@dimosthenis-botsaris-5ab16485](https://www.linkedin.com/in/dimosthenis-botsaris-5ab16485/)## Support Me
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Y8Y797KCA)
## Show your support
Give a ⭐️ if this project helped you!