fix: move SPA fallback to end after routes

This commit is contained in:
2026-03-31 13:05:42 +00:00
parent 9ea4906406
commit 13ab7d3c56

View File

@@ -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;