import express from 'express'; import { createAircallRoutes } from './aircall.routes.js'; export const createRoutes = (configs, logger) => { const router = express.Router(); // Mount Aircall routes router.use('/aircall', createAircallRoutes(configs.aircall, logger)); // Health check endpoint router.get('/health', (req, res) => { const services = req.services || {}; res.status(200).json({ status: 'ok', timestamp: new Date(), services: { redis: services.redis?.isReady || false, mongodb: services.mongo?.readyState === 1 || false } }); }); // Catch-all 404 handler router.use('*', (req, res) => { res.status(404).json({ error: 'Not Found', message: `Route ${req.originalUrl} not found` }); }); return router; };