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