This commit is contained in:
2026-02-14 03:58:31 +00:00
parent dfbc5d402f
commit 3c21d6c8e5
4 changed files with 148 additions and 0 deletions

17
frontend/index.js Normal file
View File

@@ -0,0 +1,17 @@
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}`);
});