1.1.0 • Published 4 months ago

@robinblomberg/express-async-handler v1.1.0

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

Express async handler

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

Installation

npm install @robinblomberg/express-async-handler

Usage

import { asyncHandler } from '@robinblomberg/express-async-handler';

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