open_api_spex v3.5.1 OpenApiSpex.Plug.SwaggerUI View Source
Module plug that serves SwaggerUI.
The full path to the API spec must be given as a plug option.
The API spec should be served at the given path, see OpenApiSpex.Plug.RenderSpec
Example
scope "/" do
pipe_through :browser # Use the default browser stack
get "/", MyAppWeb.PageController, :index
get "/swaggerui", OpenApiSpex.Plug.SwaggerUI, path: "/api/openapi"
end
# Other scopes may use custom stacks.
scope "/api" do
pipe_through :api
resources "/users", MyAppWeb.UserController, only: [:index, :create, :show]
get "/openapi", OpenApiSpex.Plug.RenderSpec, :show
end
Link to this section Summary
Functions
Initializes the plug
Link to this section Functions
Link to this function
init(opts) View Source
Initializes the plug.
Required params: [:path]
Example
use OpenApiSpex.Plug.SwaggerUI, path: "/api/openapi"