Swagger Docs
npm i @nestjs/swagger
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
const config = new DocumentBuilder()
.setTitle('Api Documentation')
.setDescription('The API description')
.setVersion('1.0')
.addBearerAuth()
.build();
const document = SwaggerModule.createDocument(app, config);
fs.writeFileSync('./swagger-spec.json', JSON.stringify(document));
SwaggerModule.setup('api-docs', app, document);
Swagger Annotations - Controller
@ApiTags('tasks')
@ApiBearerAuth()
@Controller('tasks')
export class TasksController {
}
REST API Documentation URL