I want to implement Swagger-UI in Vert.X app. I have listed all routes and I want to see them in swagger-ui like in SpringBoot. I have also manually edited them in swagger-editor. So, how to open localhost:8080/swagger-ui.html from vert.x app and there to see all routers.
I read that i need to save the json from swagger-editor and to put it in src/resources. After that what?
Also i found a great stuff here: https://github.com/phiz71/vertx-swagger and http://vertx.io/blog/presentation-of-the-vert-x-swagger-project/
But how to implement it?
Well, you started in the wrong direction a bit. Those examples demonstrate how to build VertX application out of Swagger files. What you want is to serve Swagger UI through VertX. I've put an example project for you: https://github.com/AlexeySoshin/VertxSwaggerUI
When you open http://localhost:8080/swagger/ you'll see all Swagger documentation, as usual.
If you want to do that by yourself:
- Copy https://github.com/swagger-api/swagger-ui/tree/master/dist contents under your resources/webroot
- Put swagger.json along with those files
- Create StaticHandler in VertX:
router.route("/*").handler(StaticHandler.create());
来源:https://stackoverflow.com/questions/48518149/how-to-open-swagger-ui-from-vert-x