Initial commit

This commit is contained in:
Lorenzo Sanesi
2026-03-26 22:46:03 +01:00
commit 18e0e04700
80 changed files with 13114 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
const express = require('express');
module.exports = ({ sequelize, mongoose }) => {
const router = express.Router();
router.get('/health', async (req, res) => {
try {
await sequelize.authenticate();
const pgStatus = 'connected';
const mongoStatus =
mongoose.connection.readyState === 1 ? 'connected' : 'disconnected';
res.json({
status: 'healthy',
timestamp: new Date().toISOString(),
services: {
postgres: pgStatus,
mongodb: mongoStatus,
},
});
} catch (error) {
res.status(503).json({
status: 'unhealthy',
timestamp: new Date().toISOString(),
error: error.message,
});
}
});
return router;
};