MCPcopy Index your code
hub / github.com/github/docs / asyncMiddleware

Function asyncMiddleware

middleware/index.js:79–81  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

77// Catch unhandled promise rejections and passing them to Express's error handler
78// https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016
79const asyncMiddleware = (fn) => (req, res, next) => {
80 Promise.resolve(fn(req, res, next)).catch(next)
81}
82
83export default function (app) {
84 // *** Request connection management ***

Callers 1

index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected