overleaf/services/chat/app/js/util/promises.js
Tim Alby 67ce7c3c75 asyncify MessageHttpController
GitOrigin-RevId: 678a22807f1cbb51a8c1c9bd11b34e1c045d9361
2022-01-14 09:03:06 +00:00

12 lines
266 B
JavaScript

/**
* 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 }