From 13ab7d3c56b7e06c357cd8bc0d0753d37d714d38 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Tue, 31 Mar 2026 13:05:42 +0000 Subject: [PATCH] fix: move SPA fallback to end after routes --- src/server/app.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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;