When I hit http://localhost:3001/api-docs loads the swagger json docs.
{
swagger: "2.0",
info: {
version: "1.0.0",
title: "Auth-gateway services",
contact: {
name: "swagger docs",
url: "https://www.google.com"
}
},
host: "127.0.0.1:3001",
basePath: "/",
...
}但是我如何为我的API加载像http://petstore.swagger.io/这样的UI呢?
发布于 2016-07-16 16:16:51
要通过swagger-ui查看您的api,请执行以下操作之一。
选项1:使用online swagger-ui
打开页面顶部的this.
生成的swagger-ui。
选项2:在本地设置swagger-ui项目
您必须设置swagger-ui。您可以克隆项目设置,并提供以下说明。
Windows Users: Please install Python before follow below guidelines
for node-gyp rebuild to run.
1. npm install
2. npm run build
3. You should see the distribution under the dist folder. Open ./dist/index.html to launch Swagger UI in a browser
Development
Use npm run serve to make a new build, watch for changes, and serve the result at http://localhost:8080/.现在,您应该能够看到与online swagger-ui完全相似的内容。
执行与选项1相同的操作,以提供swagger-json url并查看生成的swagger-ui。
https://stackoverflow.com/questions/38391810
复制相似问题