【问题标题】:how to access swagger api documentation in browser如何在浏览器中访问 swagger api 文档
【发布时间】:2018-12-04 12:16:12
【问题描述】:

我正在使用 Node Js Express js 和 swagger,我用 swagger 编写了我的 api 文档,几个月前我曾经访问过。

 Now i do not remember the URL which i used to add to browser to read documentation, which i have written in swagger. Please help me finding that URL.

【问题讨论】:

  • /documentation 试试这个

标签: node.js express swagger


【解决方案1】:

最后我得到了它的网址 http://localhost:6106/api-docs/ 我从这个页面得到了提示 https://www.npmjs.com/package/swagger-ui-express

Express setup app.js

const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');

app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-06
    • 1970-01-01
    • 1970-01-01
    • 2021-04-23
    相关资源
    最近更新 更多