feat:CI/CD Gitea 워크플로우 등 누락 파일 반영
This commit is contained in:
25
server.js
25
server.js
@@ -742,6 +742,31 @@ app.post('/api/upload', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Health check endpoint for container orchestration
|
||||
app.get('/health', async (req, res) => {
|
||||
try {
|
||||
const connection = await pool.getConnection();
|
||||
const result = await connection.query('SELECT 1');
|
||||
connection.release();
|
||||
res.status(200).json({ status: 'ok', db: 'connected' });
|
||||
} catch (err) {
|
||||
// Return degraded status if DB unreachable, but still report service as alive
|
||||
res.status(200).json({ status: 'degraded', db: 'unreachable', error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// Readiness check endpoint (only returns 200 if fully ready)
|
||||
app.get('/ready', async (req, res) => {
|
||||
try {
|
||||
const connection = await pool.getConnection();
|
||||
const result = await connection.query('SELECT 1');
|
||||
connection.release();
|
||||
res.status(200).json({ status: 'ready' });
|
||||
} catch (err) {
|
||||
res.status(503).json({ status: 'not_ready', error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(3000, '0.0.0.0', () => {
|
||||
console.log('📡 ITAM BACKEND SERVER RUNNING ON PORT 3000 (V3 Normalized)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user