This an async middleware for express, used to catch errors from async functions and redirect them to the error handler.
const asyncMiddleware = require('express-async-middleware');
const fn = async (req, res) => {
// await something
res.send('ok');
};
app.get('/path', asyncMiddleware(fn));