【发布时间】:2020-12-29 19:50:04
【问题描述】:
当 swagger 模块设置发生在 main.ts 文件上时,您将如何保护 Nestjs 上的 swagger 文档。
const options = new DocumentBuilder()
.setTitle("API")
.setDescription("NestJS api")
.setVersion("1.0")
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("swagger", app, document);
我希望对 swagger docs 端点使用如下所示的保护。
@UseGuards(RolesGuard)
【问题讨论】:
标签: api authentication swagger nestjs