首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >节点上的swagger-tools :如何加载swaggerUi?

节点上的swagger-tools :如何加载swaggerUi?
EN

Stack Overflow用户
提问于 2016-07-15 16:49:08
回答 1查看 498关注 0票数 0
代码语言:javascript
复制
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呢?

EN

回答 1

Stack Overflow用户

发布于 2016-07-16 16:16:51

要通过swagger-ui查看您的api,请执行以下操作之一。

选项1:使用online swagger-ui

打开页面顶部的this.

  • On对话框,提供-
  1. 的url。在您的示例中,插入而不是http://petstore.swagger.io/v2/swagger.json (默认情况下可以看到),然后单击Explore
  2. 现在您可以看到为您的

生成的swagger-ui。

选项2:在本地设置swagger-ui项目

您必须设置swagger-ui。您可以克隆项目设置,并提供以下说明。

代码语言:javascript
复制
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。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38391810

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档