latex-ub/services/chat/app/js/util/promises.js
2025-05-05 12:24:05 +00:00

10 lines
240 B
JavaScript

/**
* Transform an async function into an Express middleware
*
* Any error will be passed to the error middlewares via `next()`
*/
export function expressify(fn) {
return (req, res, next) => {
fn(req, res, next).catch(next)
}
}