I forgot a lot of things there, also, me when '.js' works for a router file

This commit is contained in:
Christopher Cookman 2025-08-31 10:51:07 -06:00
parent aa7bcee4ec
commit f35f0ebcb1
2 changed files with 14 additions and 4 deletions

View file

@ -52,10 +52,10 @@ app.set("view engine", "ejs");
app.set("views", "./views"); app.set("views", "./views");
app.use((req, res, next) => { app.use((req, res, next) => {
return res.send("Test 123")
if (!dbReady) { if (!dbReady) {
return res.render('error', { error: 'Database is not ready. Please try again later.' }); return res.render('error', { error: 'Database is not ready. Please try again later.' });
} }
next();
}); });
const routersDir = path.join(__dirname, 'routes'); 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 const port = process.env.APP_PORT || 8080
app.listen(port, (err) => { app.listen(port, (err) => {
if (err) { if (err) {

12
routes/.js Normal file
View file

@ -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.