31 lines
908 B
JavaScript
31 lines
908 B
JavaScript
|
|
import express from 'express';
|
||
|
|
import { createProxyMiddleware } from 'http-proxy-middleware';
|
||
|
|
import path from 'path';
|
||
|
|
import { fileURLToPath } from 'url';
|
||
|
|
|
||
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||
|
|
const app = express();
|
||
|
|
const PORT = 3456;
|
||
|
|
|
||
|
|
// Proxy alla API-anrop till landvex-admin-api (7072)
|
||
|
|
app.use('/api', createProxyMiddleware({
|
||
|
|
target: 'http://localhost:7072',
|
||
|
|
changeOrigin: true
|
||
|
|
}));
|
||
|
|
|
||
|
|
// Static files — serva admin-master.html som default
|
||
|
|
app.use(express.static(path.join(__dirname, 'ui')));
|
||
|
|
app.get('/', (req, res) => {
|
||
|
|
res.sendFile(path.join(__dirname, 'ui', 'admin-master.html'));
|
||
|
|
});
|
||
|
|
|
||
|
|
// Health check
|
||
|
|
app.get('/health', (req, res) => {
|
||
|
|
res.json({ ok: true, service: 'aamos-admin-ui', port: PORT });
|
||
|
|
});
|
||
|
|
|
||
|
|
app.listen(PORT, '0.0.0.0', () => {
|
||
|
|
console.log(`[AAMOS Admin UI] http://0.0.0.0:${PORT}`);
|
||
|
|
console.log(`[AAMOS Admin UI] API proxy: localhost:7072`);
|
||
|
|
});
|