module.exports = (req, res, next) => { if (res.marko) { res.markoAsync = async(template, input) => { const locals = Object.assign((res.locals || {}), input) for (const key in locals) { const value = locals[key] if (value instanceof Promise) { locals[key] = await value } } return res.marko(template, locals) } } if (req.user) { res.locals.user = { loggedIn: true, name: req.user._json.name, } } else { res.locals.user = { loggedIn: false, } } next() }