diff --git a/src/server/app.ts b/src/server/app.ts index e7a1847..45534db 100644 --- a/src/server/app.ts +++ b/src/server/app.ts @@ -44,10 +44,6 @@ app.use('/uploads', express.static(uploadsPath)); const distPath = path.join(process.cwd(), 'dist'); app.use(express.static(distPath)); -app.get('*', (req, res) => { - res.sendFile(path.join(distPath, 'index.html')); -}); - // Routes app.use('/api/users', userRoutes); app.use('/api/projects', projectRoutes); @@ -71,4 +67,9 @@ app.get('/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date(), auth: 'logto' }); }); +// SPA fallback - must be last +app.get('*', (req, res) => { + res.sendFile(path.join(distPath, 'index.html')); +}); + export default app;