humaflow

package
v2.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2024 License: MIT Imports: 10 Imported by: 1

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

func NewWithPrefix(m Mux, prefix string, config huma.Config) huma.API

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)
}

Directories

Path Synopsis
Package flow is a delightfully simple, readable, and tiny HTTP router for Go web applications.
Package flow is a delightfully simple, readable, and tiny HTTP router for Go web applications.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL