Simple middleware for handling exceptions inside of async express routes and passing them to your express error handlers.
npm install --save express-async-handler
or
yarn add express-async-handler
const asyncHandler = require('express-async-handler')
express.get('/', asyncHandler(async (req, res, next) => {
const bar = await foo.findAll();
res.send(bar)
}))
import * as asyncHandler from 'express-async-handler'