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 }, + }, + }, +});