简体   繁体   English

用swagger构建express.js服务器的最简单方法是什么

[英]What's the simplest way to build express.js server with swagger

I used to use hapi.js as my framework. 我曾经使用hapi.js作为框架。 To generate documentation, hapi-swagger is used. 为了生成文档,使用了hapi-swagger It is really simple. 真的很简单。 I don't need any specification document. 我不需要任何规格文件。 All I had to do is registering it as a plugin in my hapi.js server. 我要做的就是将其注册为hapi.js服务器中的插件。

When I switch to express.js, I can't find anything similar. 当我切换到express.js时,找不到类似的东西。 I found a couple popular swagger modules. 我发现了几个流行的招摇模块。 All of them require a specification document. 所有这些都需要规格文件。

Is there a way to make a self-document swagger UI for express.js server? 有没有一种方法可以为express.js服务器制作一个自文档显示的UI?

If not, what's the best way to make a swagger UI? 如果没有,那么制作一个醒目的UI的最佳方法是什么? I only need the UI to show all of my routes and their params and do some simple tests. 我只需要UI即可显示所有路线及其参数,并进行一些简单的测试。

You could use LoopBack ( http://loopback.io/getting-started/ ) and follow the instructions. 您可以使用LoopBack( http://loopback.io/getting-started/ )并按照说明进行操作。

But be aware , you need to keep writing the documentation of each file by your own. 但是请注意 ,您需要自己编写每个文件的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM