Skip to content

Commit 98040eb

Browse files
fix: serve React frontend and fix docker healthcheck
- Add express.static + SPA fallback in server so the React build is served at the root path - Replace wget healthcheck with node http call since wget is not available in node:20-slim Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f9874ac commit 98040eb

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
restart: unless-stopped
3232

3333
healthcheck:
34-
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3001/health"]
34+
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
3535
interval: 30s
3636
timeout: 10s
3737
retries: 3

server/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express from 'express';
22
import cors from 'cors';
3+
import path from 'path';
34
import 'dotenv/config';
45
import flightsRouter from './routes/flights';
56
import maritimeRouter from './routes/maritime';
@@ -23,6 +24,11 @@ app.use('/api/cyber', cyberRouter);
2324

2425
app.get('/health', (req, res) => res.json({ status: 'ok' }));
2526

27+
// Serve React frontend
28+
const publicDir = path.join(__dirname, '..', 'public');
29+
app.use(express.static(publicDir));
30+
app.get('*', (_req, res) => res.sendFile(path.join(publicDir, 'index.html')));
31+
2632
const server = app.listen(PORT, async () => {
2733
console.log(`Server intel-proxy listening on port ${PORT}`);
2834

0 commit comments

Comments
 (0)