added docker setup

This commit is contained in:
2026-02-08 19:59:49 +01:00
parent dd4d57fa1b
commit 89cf92eaf5
10 changed files with 501 additions and 1 deletions
+17
View File
@@ -69,6 +69,23 @@ app.get('/api/health', (req, res) => {
res.json({ status: 'ok', timestamp: new Date().toISOString() });
});
// Production: Serve frontend static files
if (process.env.NODE_ENV === 'production') {
const publicPath = path.join(process.cwd(), 'public');
// Serve static files
app.use(express.static(publicPath));
// SPA fallback: serve index.html for all non-API routes
app.get('*', (req, res, next) => {
// Skip API routes
if (req.path.startsWith('/api')) {
return next();
}
res.sendFile(path.join(publicPath, 'index.html'));
});
}
// Error handling
app.use((err: Error, req: express.Request, res: express.Response, next: express.NextFunction) => {
console.error(err.stack);