const express = require('express'); const path = require('path'); const app = express(); const PORT = process.env.PORT || 7860; // Must fallback to 7860 for Hugging Face // Bind your API paths const apiRoutes = require('../../../libs/api/src/routes'); app.use('/api', apiRoutes); // Dynamically serve static production web builds app.use(express.static(path.join(__dirname, '../../web/dist'))); // Handle direct client-side routes app.get('*', (req, res) => { res.sendFile(path.join(__dirname, '../../web/dist/index.html')); }); app.listen(PORT, '0.0.0.0', () => { console.log(`Server listening on port ${PORT}`); });