Closed rcebrian closed 1 year ago
internal.HandleFunc("/openapi.yaml", HandlerReturnsOpenapiYamlContent)
internal.HandleFunc("/openapi.yaml", HandlerReturnsOpenapiYamlContent)
Thanks, looking at http/main.go I saw that the correct way to call is:
func main() {
doc := redoc.Redoc{
Title: "Example API",
Description: "Example API Description",
SpecFile: "./openapi.json",
SpecPath: "/openapi.json",
DocsPath: "/docs",
}
mux := http.ServeMux{}
handler := doc.Handler()
mux.Handle("/docs", handler)
mux.Handle("/openapi.json", handler)
// ...
}
Registering the net/http handler under a mux router causes a 404 error serving de docs![image](https://user-images.githubusercontent.com/24857076/194773024-8acfad78-6f30-4160-b139-8b11f0e03494.png)
Using the following code: