Files
boc/command-center/server.mjs
T

45 lines
1.3 KiB
JavaScript
Raw Normal View History

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 = 7071;
// Proxy till aamos-ledger (3250)
app.use('/api/ledger', createProxyMiddleware({
target: 'http://localhost:3250',
changeOrigin: true,
pathRewrite: { '^/api/ledger': '' }
}));
// Proxy till quixzoom (8080)
app.use('/api/quixzoom', createProxyMiddleware({
target: 'http://localhost:8080',
changeOrigin: true,
pathRewrite: { '^/api/quixzoom': '' }
}));
// Proxy till landvex-api (8081)
app.use('/api/gateway', createProxyMiddleware({
target: 'http://localhost:8081',
changeOrigin: true,
pathRewrite: { '^/api/gateway': '' }
}));
// Static files
app.use(express.static(__dirname));
// Health check
app.get('/health', (req, res) => {
res.json({ ok: true, service: 'aamos-command-center', port: PORT });
});
app.listen(PORT, '0.0.0.0', () => {
console.log(`[AAMOS Command Center] http://0.0.0.0:${PORT}`);
console.log(`[AAMOS Command Center] Ledger proxy: localhost:3250`);
console.log(`[AAMOS Command Center] quiXzoom proxy: localhost:8080`);
console.log(`[AAMOS Command Center] Gateway proxy: localhost:8081`);
});