httproute

package
v0.0.0-...-04ccfb0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 2 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) 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) NotFound

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

func (*Router) ServeHTTP

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

Jump to

Keyboard shortcuts

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