NestJS 11 · Validation, guards and interceptors
Generate OpenAPI docs
Serve an OpenAPI document and Swagger UI. Install @nestjs/swagger first.
const config = new DocumentBuilder().setTitle('Cats API').setVersion('1.0').build();
SwaggerModule.setup('docs', app, SwaggerModule.createDocument(app, config));
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
- Enable CORS
All validation, guards and interceptors commands · NestJS 11 cheatsheet