router

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MethodNotAllowed func(http.ResponseWriter, *http.Request, []string) = methodNotAllowed
View Source
var NotFound func(http.ResponseWriter, *http.Request, []string) = notFound

Functions

func Recovery

func Recovery() func(http.ResponseWriter, *http.Request, []string) bool

Types

type CORSConfig

type CORSConfig struct {
	// contains filtered or unexported fields
}

func (*CORSConfig) Credentials

func (c *CORSConfig) Credentials(allow bool) *CORSConfig

func (*CORSConfig) Enable

func (c *CORSConfig) Enable() *CORSConfig

func (*CORSConfig) Headers

func (c *CORSConfig) Headers(headers ...string) *CORSConfig

func (*CORSConfig) MaxAge

func (c *CORSConfig) MaxAge(seconds int) *CORSConfig

func (*CORSConfig) Methods

func (c *CORSConfig) Methods(methods ...string) *CORSConfig

func (*CORSConfig) Origin

func (c *CORSConfig) Origin(origins ...string) *CORSConfig

type Router

type Router struct {
	Recover bool
	// contains filtered or unexported fields
}

func New

func New() *Router

func NewRecovery

func NewRecovery() *Router

func (*Router) All

func (r *Router) All(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) DELETE

func (r *Router) DELETE(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) GET

func (r *Router) GET(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) HEAD

func (r *Router) HEAD(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) Handle

func (r *Router) Handle(method, pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) ListenAndServe

func (r *Router) ListenAndServe(addr string) error

func (*Router) ListenAndServeTLS

func (r *Router) ListenAndServeTLS(addr, certFile, keyFile string) error

func (*Router) Medium

func (r *Router) Medium(mw func(http.ResponseWriter, *http.Request, []string) bool)

func (*Router) OPTIONS

func (r *Router) OPTIONS(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) Option

func (r *Router) Option(pattern string) *CORSConfig

func (*Router) PATCH

func (r *Router) PATCH(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) POST

func (r *Router) POST(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) PUT

func (r *Router) PUT(pattern string, handler func(http.ResponseWriter, *http.Request, []string))

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Router) Static

func (r *Router) Static(pattern, root string)

func (*Router) Sub

func (r *Router) Sub(prefix string) *Router

type Type

type Type int
const (
	Int      Type = 1
	Float    Type = 2
	Alpha    Type = 3
	AlphaNum Type = 4
	UUID     Type = 5
	String   Type = 6
)

Jump to

Keyboard shortcuts

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