Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2026-01-20 03:47:28 +01:00
parent 2189af270d
commit e8f3154ca2
3 changed files with 28 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ COPY middlewares/ ./middlewares/
COPY routes/ ./routes/
COPY services/ ./services/
COPY utils/ ./utils/
COPY workers.json ./workers.json
COPY ../workers.json ./workers.json
# Exponer puerto
EXPOSE 3001

View File

@@ -6,6 +6,31 @@ import { broadcast } from '../services/websocket.js';
const router = express.Router();
// Health check (no requiere autenticación)
router.get('/health', async (req, res) => {
try {
// Verificar que MongoDB está disponible (opcional, no falla si no está)
const db = getDB();
const mongodbStatus = db ? 'connected' : 'unavailable';
res.json({
status: 'ok',
timestamp: new Date().toISOString(),
mongodb: mongodbStatus,
service: 'wallamonitor-backend'
});
} catch (error) {
// Incluso si hay un error, el servidor está funcionando, así que retornamos ok
res.json({
status: 'ok',
timestamp: new Date().toISOString(),
mongodb: 'error',
service: 'wallamonitor-backend',
error: error.message
});
}
});
// Obtener estadísticas (requiere autenticación obligatoria)
router.get('/stats', basicAuthMiddleware, async (req, res) => {
try {