EvalueTonSavoir/server/routers/routerUtils.js

7 lines
241 B
JavaScript
Raw Permalink Normal View History

// asyncHandler is a wrapper for async functions that catch errors and pass them to the next middleware
const asyncHandler = fn => (req, res, next) => {
Promise.resolve(fn(req, res, next)).catch(next);
};
module.exports = asyncHandler;