From d5e68b8e7f77fa001ae301130754c47e9dadbfba Mon Sep 17 00:00:00 2001 From: 00Fjongl <65314359+00Fjongl@users.noreply.github.com> Date: Sat, 6 Jul 2024 22:41:47 -0500 Subject: [PATCH] Starting to comment over the file navigation system. --- src/server.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/server.mjs b/src/server.mjs index 7b0a5c84..20ce81cd 100644 --- a/src/server.mjs +++ b/src/server.mjs @@ -76,7 +76,18 @@ server.on('upgrade', (req, socket, head) => { } }); -router.get('/', async (req, res) => res.send(paintSource(tryReadFile(path.join(__dirname, 'views', ['/', '/?'].includes(req.url) ? pages.index : pages[Object.keys(req.query)[0]]))))); + +// All website files are stored in the /views directory. +// This takes one of those files and displays it for a site visitor. +router.get('/', async (req, res) => res.send(paintSource(tryReadFile( + path.join(__dirname, + 'views', +// This returns the file path, and has the index page set as the home page. + '/?'.indexOf(req.url) ? pages[Object.keys(req.query)[0]] : pages.index + ) +)))); + + app.use(router); app.use(express.static(path.join(__dirname, 'views'))); app.use("/uv/", express.static(uvPath));