blob: b5fcd3433f049a95a72177832878c05bafd3d1b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { PageDirectory } from "../pages.js";
export const directory = (pageDirectory: PageDirectory) => {
return ((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();
});
}
|