multiplexer

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

README

multiplexer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain added in v0.4.0

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

Chain represents a chain of middlewares.

func NewChain added in v0.4.0

func NewChain(mws ...Middleware) Chain

NewChain creates a new Chain with the provided middlewares.

func (Chain) Append added in v0.4.0

func (c Chain) Append(mws ...Middleware) Chain

Append appends the provided middlewares to the chain.

func (Chain) Wrap added in v0.4.0

func (c Chain) Wrap(h http.Handler) http.Handler

Wrap wraps the provided http.Handler with the chain of middlewares.

func (Chain) WrapFunc added in v0.4.0

func (c Chain) WrapFunc(h http.HandlerFunc) http.Handler

WrapFunc wraps the provided http.HandlerFunc with the chain of middlewares.

type Middleware added in v0.4.0

type Middleware func(http.Handler) http.Handler

Middleware is a function that takes a http.Handler and returns a http.Handler

type Router

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

Router represents a multiplexer that routes incoming HTTP requests.

func New

func New(mux *http.ServeMux) *Router

New creates a new instance of the Router struct. It initializes the mux field with a new instance of http.ServeMux. Returns a pointer to the newly created Router.

func (*Router) Handle added in v0.3.0

func (r *Router) Handle(pattern string, handler http.Handler)

Handle adds a new route with the given pattern and handler.

func (*Router) HandleFunc added in v0.3.0

func (r *Router) HandleFunc(pattern string, handler http.HandlerFunc)

HandleFunc adds a new route with the given pattern and handler function.

func (*Router) ServeHTTP added in v0.2.0

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

ServeHTTP implements the http.Handler interface. It calls the ServeHTTP method of the underlying http.ServeMux.

Jump to

Keyboard shortcuts

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