简体   繁体   中英

Create Swagger-docs for API written in Express 4.x

I have a server written with Node and Express 4. I also have a customer which wants this to be documented with Swagger. How can this be done?

I've looked into the following tools:

  • swagger-node-express : Lets you do exactly what I want, except it does not support Express 4.x
  • Swagger 2.0 - Node-Express-4.x : Same as above but with a different approach. Could be used, except I don't find much documentation on setting it up (and I'm too slow to get it without docs)

Tools like swaggerize-express and Swaggers own tool for Node would work if I started from scratch, but I just want a way to easiliy add docs to my project so that Swagger can read it.

It wouldn't work in the long run to write a doc-file that Swagger can read because then I'd have to update it. I want to document everything in the code and not a Swagger- or readme-file, and let the documentation be available through a Swagger-UI automatically.

I may have overlooked something here, but I can't seem to find anything to help me.All suggestions are welcome. Thanks in advance.

I highly recommend looking into Loopback framework. It's framework for creating REST APIs on stereoids. It is using Express under the hood and is created by company StrongLoop, which also maintains Express project itself now.

It supports Swagger out of the box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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