mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
7 lines
241 B
JavaScript
7 lines
241 B
JavaScript
|
|
// 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;
|