Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Swagger-ui from vert.x

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?

like image 750
xmlParser Avatar asked Jan 30 '18 09:01

xmlParser


People also ask

How do I view swagger UI?

Go to http://localhost:8000/ in your address bar. This address lets you view the local web server. By default, web servers default to the index. html file in the directory, so it will show the Swagger UI file automatically.


1 Answers

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:

  1. Copy https://github.com/swagger-api/swagger-ui/tree/master/dist contents under your resources/webroot
  2. Put swagger.json along with those files
  3. Create StaticHandler in VertX: router.route("/*").handler(StaticHandler.create());
like image 187
Alexey Soshin Avatar answered Sep 26 '22 14:09

Alexey Soshin