Complete the code to import the Swagger module in a NestJS app.
import { [1] } from '@nestjs/swagger';
The SwaggerModule is the correct import from @nestjs/swagger to set up Swagger in NestJS.
Complete the code to create Swagger options with a title.
const config = new DocumentBuilder().setTitle('[1]').build();
The title can be any string, but 'NestJS API' is a common descriptive title for the API docs.
Fix the error in the code to create Swagger document in main.ts.
const document = [1].createDocument(app, config);The SwaggerModule has the createDocument method to generate the Swagger document.
Fill both blanks to setup Swagger UI in main.ts.
SwaggerModule.[1](app, document, { swaggerOptions: { [2]: true } });
The setup method mounts Swagger UI, and showExplorer enables the API explorer sidebar.
Fill all three blanks to add a tag and description in Swagger DocumentBuilder.
const config = new DocumentBuilder().setTitle('API').setDescription('[1]').addTag('[2]').setVersion('[3]').build();
The description is 'User operations', the tag is 'users', and the version is '1.0' to describe the API clearly.