fix: не падать без БД, добавить .gitignore

This commit is contained in:
2026-05-29 22:19:04 +03:00
parent 814625ef57
commit f9c1d5ac4c
2 changed files with 13 additions and 11 deletions
+7
View File
@@ -0,0 +1,7 @@
.env
node_modules/
__pycache__/
*.pyc
.DS_Store
.vscode/
.idea/
+6 -11
View File
@@ -31,15 +31,10 @@ app.get('/', (req, res) => {
res.render('index', { title: 'IP WhiteList' });
});
async function start() {
try {
const ok = await checkConnection();
console.log('DB connected:', ok);
app.listen(PORT, () => console.log(`Server on port ${PORT}`));
} catch (e) {
console.error('DB connection failed:', e.message);
process.exit(1);
}
}
// Не падаем если БД недоступна — healthcheck покажет статус
let dbOk = false;
checkConnection()
.then(() => { dbOk = true; console.log('DB connected'); })
.catch((e) => console.error('DB not ready:', e.message));
start();
app.listen(PORT, () => console.log(`Server on port ${PORT}`));