overleaf/services/chat/app/js/util/promises.js

13 lines
266 B
JavaScript
Raw Normal View History

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