fix: nginx proxy URI, SW cache, sw.js no-cache
This commit is contained in:
+15
-1
@@ -124,4 +124,18 @@ if (fs.existsSync(frontendPath)) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.static(frontendPath));
|
app.use(express.static(frontendPath));
|
||||||
// SPA fallback - toutes les routes non-API ser
|
// SPA fallback - toutes les routes non-API servent index.html
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
if (!req.path.startsWith('/api')) {
|
||||||
|
res.sendFile(path.join(frontendPath, 'index.html'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Démarrage ───────────────────────────────────────────────────────────────
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`🚀 EquiTask API démarrée sur le port ${PORT}`);
|
||||||
|
console.log(` Mode : ${process.env.NODE_ENV || 'development'}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
||||||
|
|||||||
@@ -46,4 +46,7 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
port: 5173,
|
port: 5173,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': { target: 'http://localhost
|
'/api': { target: 'http://localhost:3001', changeOrigin: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user