mux

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func NewMuxWithConfig

func NewMuxWithConfig(d *Config) (http.Handler, error)

Types

type Config

type Config struct {
	Routes   map[string]modules.Handlers
	NotFound modules.Handlers
}

type Mux

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

Mux is an path protocol multiplexer.

func NewMux

func NewMux() *Mux

NewMux create a new Mux.

func (*Mux) Handle

func (m *Mux) Handle(pattern string, handler http.Handler) error

Handle registers the handler for the given pattern in the Mux.

func (*Mux) Handler

func (m *Mux) Handler(r string) (handler http.Handler, path []byte, err error)

Handler returns most matching handler and prefix bytes data to use for the given reader.

func (*Mux) NotFound

func (m *Mux) NotFound(handler http.Handler) error

NotFound replies to the handler with an Handler not found error.

func (*Mux) ServeHTTP

func (m *Mux) ServeHTTP(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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