Documentation
¶
Overview ¶
Package redoc provides a Redoc UI for stdocs.
Redoc is a clean, three-pane OpenAPI viewer, loaded from a CDN. To use it, import this sub-package and pass redoc.WithUI() to stdocs.New or stdocs.DocsHandler:
import (
"github.com/FumingPower3925/stdocs"
"github.com/FumingPower3925/stdocs/ui/redoc"
)
mux := stdocs.New(stdocs.WithTitle("My API"), redoc.WithUI())
mux.HandleFunc("GET /x", h)
mux.Mount()
This sub-package adds the Redoc HTML to the docs handler. The Redoc JavaScript and CSS are loaded from cdn.jsdelivr.net at page load time, so an internet connection is required.
The CDN URL is pinned to a specific version (2.5.3, the current latest 2.x). Integrity hashes (sha384) are pre-computed and pinned. Bumping the pinned version requires re-computing the hash (the recipe is inlined above the hash constant below). For an air-gapped build, use the ui/redocemb sub-package instead — it vendors the bundle in-repo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.