promises.js 240 B

12345678910
  1. /**
  2. * Transform an async function into an Express middleware
  3. *
  4. * Any error will be passed to the error middlewares via `next()`
  5. */
  6. export function expressify(fn) {
  7. return (req, res, next) => {
  8. fn(req, res, next).catch(next)
  9. }
  10. }