load redoc in a path problem
piusalfred opened this issue · 2 comments
piusalfred commented
This is example of my code where I try to load the openapi spec in a certain path. Code is not compiled its just
to show how I did it.
Client struct {
Router *mux.Router
}
client := &Client{}
doc := redoc.Redoc{
Title: "",
Description: "",
SpecFile: "./api.yaml",
SpecPath: "/api.yaml",
DocsPath: "/docs",
}
client.Router.HandleFunc("/hello",HelloHandlerFunc).Methods(http.MethodGet)
client.Router.HandleFunc("/openapi",doc.Handler).Methods(http.MethodGet)
I am trying to access the docs through http://localhost:port/openapi/docs without luck. It just return blank white page
mvrilo commented
Hi @piusalfred, I pushed some changes to allow better use of the handler (without any route matching), plus I added an example using gorilla mux, hope it helps:
https://github.com/mvrilo/go-redoc/blob/master/_examples/gorilla/main.go
piusalfred commented
Thanks for the fix @mvrilo worked like charm.