如何在我的应用程序中集成 swagger-ui [英] How to integrate swagger-ui in my application
问题描述
我正在尝试将 swagger 与骆驼项目集成
I am trying to integrate swagger with camel project
按照这个例子https://github.com/smparekh/camel-示例-servlet-rest-tomcat
如何使用此示例项目访问 swagger-ui?
How do i access swagger-ui using this example project ?
我在tomcat中删除了war文件.
I delopyed the war file in tomcat.
并访问 http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs 我明白了......
and access http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs i get this ...
{"apiVersion":"1.2.3","swaggerVersion":"1.2","apis":[{"path":"/user","description":"用户休息服务"}],"info":{"title":"User Services","description":"Camel Rest Example with Swagger 提供用户 REST 服务"}}
{"apiVersion":"1.2.3","swaggerVersion":"1.2","apis":[{"path":"/user","description":"User rest service"}],"info":{"title":"User Services","description":"Camel Rest Example with Swagger that provides an User REST service"}}
但我的问题是 - 我如何访问 swagger-ui/index.html?
BUT MY QUESTION IS - how do i access swagger-ui/index.html?
访问 swagger-UI 的确切 URL 是什么?
what is the exact URL to access swagger-UI?
推荐答案
您必须将 swagger-ui 的 dist 文件夹的内容复制到您项目的 webapp 文件夹中.
You must copy the contents of the dist folder of swagger-ui into your project's webapp folder.
在 index.html 中,
In index.html,
window.swaggerUi = new SwaggerUi({
url: "http://petstore.swagger.wordnik.com/api/api-docs",
dom_id: "swagger-ui-container",
你必须用这个替换 url
you must replace url with this
http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs
有关详细信息,请点击此链接以集成 swagger-ui.
For details, Follow this link to integrate swagger-ui.
https://github.com/swagger-api/swagger-ui
这篇关于如何在我的应用程序中集成 swagger-ui的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!