const express = require('express'); const path = require('path'); const app = express(); const port = process.env.PORT || 3000; const backendUrl = process.env.BACKEND_URL || 'http://localhost:3001'; app.get('/config.js', (req, res) => { res.set('Content-Type', 'application/javascript'); res.send(`window.BACKEND_URL = "${backendUrl}";`); }); app.use(express.static(path.join(__dirname, 'public'))); app.listen(port, () => { console.log(`Frontend service listening at http://localhost:${port}`); console.log(`Configured to use backend at: ${backendUrl}`); });