const handler = require('express-async-handler'); function template(name) { return handler( async function (req, res) { return res.template(name, { current_route: req.originalUrl }); } ); } module.exports = (router) => { router.get('/osp/lightkeeper', template('osp/lightkeeper.pug')); router.get('/osp/bfile', template('osp/bfile.pug')); }