fix: не падать без БД, добавить .gitignore
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
.env
|
||||||
|
node_modules/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.DS_Store
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
@@ -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}`));
|
||||||
|
|||||||
Reference in New Issue
Block a user