Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

Welcome to @dimosbotsaris/express-async-handler 👋




Version



Documentation


Maintenance


Twitter: el_dimious

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