npm.io
1.0.1 • Published 6 years ago

express-async-middleware

Licence
ISC
Version
1.0.1
Deps
0
Size
716 B
Vulns
0
Weekly
0

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));