Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

express-async-handler

1.1.4 • Public • Published

Simple middleware for handling exceptions inside of async express routes and passing them to your express error handlers.

Installation:

npm install --save express-async-handler

or

yarn add express-async-handler

Usage:

const asyncHandler = require('express-async-handler')
 
express.get('/', asyncHandler(async (req, res, next) => {
    const bar = await foo.findAll();
    res.send(bar)
}))

Import in Typescript:

import * as asyncHandler from 'express-async-handler'

Install

npm i express-async-handler

DownloadsWeekly Downloads

70,505

Version

1.1.4

License

MIT

Unpacked Size

12.7 kB

Total Files

7

Last publish

Collaborators

  • avatar