Fix Express 5 wildcard routing in SPA fallback
This commit is contained in:
1 parent
7f4fed3c8c
commit
0c98b1babf
1 file changed
+1
-1
+1
-1
@@ -199,7 +199,7 @@ if (fs.existsSync(distPath)) {
|
||||
app.use(express.static(distPath));
|
||||
|
||||
// SPA Fallback: serve index.html for unknown routes
|
||||
app.get('*', (req, res) => {
|
||||
app.use((req, res) => {
|
||||
if (req.path.startsWith('/api') || req.path.startsWith('/uploads')) {
|
||||
return res.status(404).json({ error: 'Not found' });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user