标签:服务 blog 查看 swa index query 默认 new div
git clone https://github.com/swagger-api/swagger-editor.git
cd swagger-editor
npm install
npm run build
npm start
http://localhost:8080/swagger-editor/index.html
git clone https://github.com/swagger-api/swagger-ui.git
cd swagger-editor
npm install
npm run build
npm start
http://localhost:8080/swagger-ui/dist/index.html
默认会引用 http://petstore.swagger.io/v2/swagger.json 这个api,有两种可以修改默认访问的方法:
直接修改 swagger-ui/dist/index.html 文件中的 url 的值
var swaggerUi = new SwaggerUi({
url: 'http://petstore.swagger.io/v2/swagger.json', // url of specification
dom_id: 'swagger-ui-container' //id of element where to render swagger-ui
});
swaggerUi.load();
通过query传入url的值
{your_host}/dist/index.html?url={specification_link}
例如: http://localhost:8080/swagger-ui/dist/index.html?url=http://localhost:8080/rest/create.json
标签:服务 blog 查看 swa index query 默认 new div
原文地址:http://www.cnblogs.com/skating/p/7865784.html