【发布时间】:2021-10-18 11:28:30
【问题描述】:
我有 Swagger,效果很好。但我找不到将路由导出到 JSON 的方法。 我记得这样做过,只是在浏览器中访问一个 URL,但我现在不记得了。
我的招摇是这样设置的:
const swaggerOptions = new DocumentBuilder()
.setTitle('Some API Docs')
.setDescription('Some API description')
.setVersion('1.0')
.build();
const swaggerDocument = SwaggerModule.createDocument(app, swaggerOptions);
SwaggerModule.setup('docs', app, swaggerDocument);
我可以使用以下方法访问 Swagger UI: 本地主机:3000/docs
我已经阅读了official documentation,他们提到使用:
- http://localhost:3000/api/json 或 http://localhost:3000/api-json
另外,我看了一下,有这个thread
不幸的是,在我的情况下这些都不起作用。
获取 JSON 文档的 URL 是什么?
【问题讨论】:
标签: swagger nestjs swagger-ui