Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MultipartMaxMemory int64 = 8 * 1024
MultipartMaxMemory is the maximum memory to use when parsing multipart form data.
Functions ¶
func New ¶
func New(m Mux, config huma.Config) huma.API
New creates a new Huma API using an HTTP mux.
mux := http.NewServeMux() api := humago.New(mux, huma.DefaultConfig("My API", "1.0.0"))
func NewAdapter ¶
func NewAdapter(m Mux) huma.Adapter
NewAdapter creates a new adapter for the given chi router.
func NewContext ¶
func NewContext(op *huma.Operation, r *http.Request, w http.ResponseWriter) huma.Context
NewContext creates a new Huma context from an HTTP request and response.
func NewWithPrefix ¶
NewWithPrefix creates a new Huma API using an HTTP mux with a URL prefix. This behaves similar to other router's group functionality, adding the prefix before each route path (but not in the OpenAPI). The prefix should be used in combination with the `OpenAPI().Servers` base path to ensure the correct URLs are generated in the OpenAPI spec.
mux := flow.New() config := huma.DefaultConfig("My API", "1.0.0") config.Servers = []*huma.Server{{URL: "http://example.com/api"}} api := humago.NewWithPrefix(mux, "/api", config)
Types ¶
type Mux ¶
type Mux interface { HandleFunc(pattern string, handler http.HandlerFunc, methods ...string) ServeHTTP(http.ResponseWriter, *http.Request) }
Click to show internal directories.
Click to hide internal directories.