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' }); res.render('index', { title: 'IP WhiteList' });
}); });
async function start() { // Не падаем если БД недоступна — healthcheck покажет статус
try { let dbOk = false;
const ok = await checkConnection(); checkConnection()
console.log('DB connected:', ok); .then(() => { dbOk = true; console.log('DB connected'); })
app.listen(PORT, () => console.log(`Server on port ${PORT}`)); .catch((e) => console.error('DB not ready:', e.message));
} catch (e) {
console.error('DB connection failed:', e.message);
process.exit(1);
}
}
start(); app.listen(PORT, () => console.log(`Server on port ${PORT}`));