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; };