fix: move SPA fallback to end after routes
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user