From 6af62b401c9e973aec1fbcc1ff6c524340c6f753 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 1 May 2026 07:53:54 +0200 Subject: [PATCH] fix: nginx proxy URI, SW cache, sw.js no-cache --- backend/src/index.ts | 16 +++++++++++++++- frontend/vite.config.ts | 5 ++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 2c0cbd3..b5c2c0e 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -124,4 +124,18 @@ if (fs.existsSync(frontendPath)) { }); app.use(express.static(frontendPath)); - // SPA fallback - toutes les routes non-API ser \ No newline at end of file + // 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; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 0a8c86d..3ddb5ed 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -46,4 +46,7 @@ export default defineConfig({ server: { port: 5173, proxy: { - '/api': { target: 'http://localhost \ No newline at end of file + '/api': { target: 'http://localhost:3001', changeOrigin: true }, + }, + }, +});