Remove redis and add healthcheck endpoint

This commit is contained in:
2026-08-17 22:50:49 +03:30
parent 1618eae69f
commit 86655f2b69
10 changed files with 66 additions and 146 deletions
+13
View File
@@ -31,6 +31,19 @@ app.use(express.json())
app.set('view engine', 'ejs')
app.use(express.static('views/public'))
// Health check endpoint
app.get(['/health', '/healthz', '/api/health'], (req, res) => {
const mongoose = require('mongoose')
const isDbConnected = mongoose.connection.readyState === 1
res.status(isDbConnected ? 200 : 503).json({
status: isDbConnected ? 'healthy' : 'unhealthy',
uptime: process.uptime(),
timestamp: new Date().toISOString(),
service: 'belonging-manager-api',
database: isDbConnected ? 'connected' : 'disconnected',
})
})
app.use('/api', routerEndpoints)
const { registerEventHandlers } = require('./events/index')