1.0.1 • Published 5 years ago

express-async-middleware v1.0.1

Weekly downloads
12
License
ISC
Repository
-
Last release
5 years ago

express-async-middleware

This an async middleware for express, used to catch errors from async functions and redirect them to the error handler.

Usage

const asyncMiddleware = require('express-async-middleware');

const fn = async (req, res) => {
  // await something

  res.send('ok');
};

app.get('/path', asyncMiddleware(fn));