10 lines
198 B
JavaScript
10 lines
198 B
JavaScript
export function asyncHandler(handler) {
|
|
return async function wrappedHandler(req, res, next) {
|
|
try {
|
|
await handler(req, res, next);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
};
|
|
}
|