From f35f0ebcb10b99f7026f48555cb8dc2ec3c9fc24 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 31 Aug 2025 10:51:07 -0600 Subject: [PATCH] I forgot a lot of things there, also, me when '.js' works for a router file --- index.js | 6 ++---- routes/.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 routes/.js diff --git a/index.js b/index.js index 01723df..bc132a8 100644 --- a/index.js +++ b/index.js @@ -52,10 +52,10 @@ app.set("view engine", "ejs"); app.set("views", "./views"); app.use((req, res, next) => { - return res.send("Test 123") if (!dbReady) { return res.render('error', { error: 'Database is not ready. Please try again later.' }); } + next(); }); const routersDir = path.join(__dirname, 'routes'); @@ -67,9 +67,7 @@ fs.readdirSync(routersDir).forEach(file => { } }); -app.get('/', (req, res) => { - res.redirect('/login'); -}) + const port = process.env.APP_PORT || 8080 app.listen(port, (err) => { if (err) { diff --git a/routes/.js b/routes/.js new file mode 100644 index 0000000..f9a6b99 --- /dev/null +++ b/routes/.js @@ -0,0 +1,12 @@ +const express = require('express'); +const db = global.db; +const router = express.Router(); + +// GET /login +router.get('/', (req, res) => { + res.send("Test") +}); + +module.exports = router; + +// I genuinely have no clue if this'll work.... but hey, it's worth a shot. \ No newline at end of file