Package swgui
(Swagger UI) provides HTTP handler to serve Swagger UI.
All assets are embedded in Go source code, so just build and run.
Static assets for v3
are built from Swagger UI v3.20.7.
package main
import (
"net/http"
"github.com/swaggest/swgui/v3"
)
func main() {
http.Handle("/", v3.NewHandler("My API", "/swagger.json", "/"))
http.ListenAndServe(":8080", nil)
}
Install swgui-server
go get github.com/swaggest/swgui/...
Start server
swgui-server -port 8080