phoenix_swagger v0.8.2 PhoenixSwagger.Plug.SwaggerUI View Source

Swagger UI in a plug

Usage:

Generate a swagger file and place it in your applications priv/static dir:

mix phoenix.swagger.generate priv/static/myapp.json

Add a swagger scope to your router, and forward all requests to SwaggerUI

scope "myapp/api/swagger" do
  forward "/", PhoenixSwagger.Plug.SwaggerUI, otp_app: :myapp, swagger_file: "myapp.json"
end

Run the server with mix phoenix.server and browse to localhost:8080/myapp/api/swagger/, swagger-ui should be shown with your swagger spec loaded.

Link to this section Summary

Functions

Plug.call callback

Plug.init callback

Link to this section Functions

Plug.call callback

Plug.init callback

Options:

  • otp_app (required) The name of the app has is hosting the swagger file
  • swagger_file (required) The name of the file, eg "swagger.json"