diff --git a/README.md b/README.md index 8bee5af..f893d39 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,22 @@ import ( ) func main() { - http.Handle("/", v5emb.NewHandler("My API", "/swagger.json", "/")) - _ = http.ListenAndServe(":8080", nil) + http.Handle("/api1/docs/", v5emb.New( + "Petstore", + "https://petstore3.swagger.io/api/v3/openapi.json", + "/api1/docs/", + )) + + http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { + _, _ = writer.Write([]byte("Hello World!")) + }) + + println("docs at http://localhost:8080/api1/docs/") + _ = http.ListenAndServe("localhost:8080", http.DefaultServeMux) } ``` + If you use `go1.16` or later, you can import natively embedded assets with `"github.com/swaggest/swgui/v5emb"`, it may help to lower application memory usage. diff --git a/internal/index.tpl.go b/internal/index.tpl.go index f4d4392..f044c19 100644 --- a/internal/index.tpl.go +++ b/internal/index.tpl.go @@ -93,7 +93,10 @@ func IndexTpl(assetsBase, faviconBase string, cfg swgui.Config) string {