diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-11-21 23:06:06 +0000 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-11-21 23:06:06 +0000 |
| commit | 2607289a6f4391258ef4377365900cded65cadb1 (patch) | |
| tree | 64b859c1f8a2e0b5375255fe65577a8933ef3db9 /app/index.mjs | |
| parent | b49458699376b18c3f5a018973669685e213ef62 (diff) | |
Add raw view
Diffstat (limited to 'app/index.mjs')
| -rw-r--r-- | app/index.mjs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/index.mjs b/app/index.mjs index 08bd8cb..cf47100 100644 --- a/app/index.mjs +++ b/app/index.mjs @@ -17,6 +17,19 @@ app.use(express.static(__dirname + '/static')); app.set('view engine', 'ejs'); app.set('views', __dirname + '/views'); +app.get('/:page.wiki', (req, res) => { + let path = req.params.page; + let page = directory.pageFor(path); + + if (!page) { + error(res, 404); + return; + } + + res.type('text/plain'); + res.send(page.raw).end(); +}); + app.get('/:page?', (req, res) => { let path = req.params.page ?? 'index'; let page = directory.pageFor(path); |
