NestJS · Junior · Question 42 of 75
Where do you configure CORS in a Nest app?
- 1In every controller
- ✓Correct answer:
app.enableCors()inmain.ts(or thecorsoption ofNestFactory.create) - 3In the database config
Explanation
Pass allowed origins, methods and credentials. Avoid allowing every origin together with credentials.