mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-12 21:10:59 +00:00
12 lines
266 B
JavaScript
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 }
|