httproute

package
v0.0.0-...-ee57881 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParam

func GetParam(r *http.Request, name string) string

Types

type Middleware

type Middleware interface {
	Handle(http.Handler) http.Handler
}

func Chain

func Chain(ms ...Middleware) Middleware

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

func (MiddlewareFunc) Handle

func (f MiddlewareFunc) Handle(h http.Handler) http.Handler

type Route

type Route struct {
	Methods     []string
	PathPattern string
	Middleware  Middleware
}

func (Route) PrependPathPattern

func (r Route) PrependPathPattern(pathPattern string) Route

func (Route) WithMethods

func (r Route) WithMethods(methods ...string) Route

func (Route) WithMiddleware

func (r Route) WithMiddleware(middleware Middleware) Route

func (Route) WithPathPattern

func (r Route) WithPathPattern(pathPattern string) Route

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) Add

func (r *Router) Add(route Route, h http.Handler)

func (*Router) AddRoutes

func (r *Router) AddRoutes(h http.Handler, routes ...Route)

func (*Router) HTTPHandler

func (r *Router) HTTPHandler() http.Handler

func (*Router) NotFound

func (r *Router) NotFound(route Route, h http.Handler)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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