Async Error Handling Middleware for Express
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7a95243 Aug 10, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore init Nov 30, 2017
.travis.yml add travis Mar 10, 2018
README.md Typescript declaration Jan 3, 2018
index.d.ts TS typing for async handler function Mar 21, 2018
index.js Error-handling middleware support (Fixes #22) Jul 21, 2018
package.json v1.1.4 Aug 9, 2018
test.js chore(thenables): refactor test Mar 21, 2018
yarn.lock add some additional tests Jan 25, 2018

README.md

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'