NestJS 11 · Validation, guards and interceptors
Enable CORS
Allow browser apps on other origins to call the API.
const app = await NestFactory.create(AppModule);
app.enableCors({ origin: 'https://app.example.com' });
Official NestJS 11 documentation
More validation, guards and interceptors commands
- Describe and validate a request body
- Enable validation globally
- Protect routes with a guard
- Run code around handlers
- Customize error responses
- Generate OpenAPI docs
All validation, guards and interceptors commands · NestJS 11 cheatsheet