1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import { PageDirectory } from "../pages.js"; export const page = ((req, res, next) => { const path = req.originalUrl == "/" ? 'index' : req.originalUrl.substring(1); res.locals.path = path; const page = PageDirectory.get(path); if (!page) { next(); return; } res.locals.page = page; next(); });