diff --git a/backend/src/main.ts b/backend/src/main.ts index 1602cec..3943463 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -11,7 +11,14 @@ import { ValidationPipe } from '@nestjs/common'; async function bootstrap() { const app = await NestFactory.create(AppModule, { logger: ['error', 'warn', 'log', 'debug', 'verbose'] }); - app.enableCors(); + + // Configuration CORS pour autoriser les requêtes depuis localhost (dev) et production + app.enableCors({ + origin: true, // Autorise toutes les origines (dev) - à restreindre en prod + methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], + allowedHeaders: ['Content-Type', 'Authorization', 'Accept'], + credentials: true, + }); app.useGlobalPipes( new ValidationPipe({