fix: не падать без БД, добавить .gitignore
This commit is contained in:
@@ -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}`));
|
||||
|
||||
Reference in New Issue
Block a user