1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-10 04:55:17 +02:00
flame/middleware/asyncWrapper.js

17 lines
350 B
JavaScript
Raw Permalink Normal View History

// const asyncWrapper = foo => (req, res, next) => {
// return Promise
// .resolve(foo(req, res, next))
// .catch(next);
// }
// module.exports = asyncWrapper;
function asyncWrapper(foo) {
return function (req, res, next) {
return Promise
.resolve(foo(req, res, next))
.catch(next);
}
}
module.exports = asyncWrapper;