The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
567 B

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()
}