Documentation
¶
Overview ¶
Package muxify implements functionality for building a http.ServeMux.
The muxify package is a default serve mux builder. Build patterns, handlers and wrap middlewares conveniently upfront. The muxify.Mux acts as a builder for the http.ServeMux. The overall goal of this package is to build the http.ServeMux with pattern/path prefixes and middleware wired in.
Index ¶
- type Middleware
- type Mux
- func (mux *Mux) Handle(pattern string, handler http.Handler)
- func (mux *Mux) HandleFunc(pattern string, handlerFunc func(http.ResponseWriter, *http.Request))
- func (mux *Mux) Prefix(prefix string) *Mux
- func (mux *Mux) PrintRegisteredPatterns()
- func (mux *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (mux *Mux) Subrouter() *Mux
- func (mux *Mux) Use(middleware ...Middleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
Middleware represents an http.Handler wrapper to inject additional functionality.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a simple wrapper for the http.ServeMux.
func NewMux ¶
func NewMux() *Mux
NewMux returns a new muxify.Mux. This is a simple wrapper for the http.ServeMux.
func (*Mux) Handle ¶
Handle wraps the http.Handle func. It wraps the pattern with prefixes and the handler with middlewares.
func (*Mux) HandleFunc ¶
HandleFunc wraps the http.HandleFunc func. It wraps the pattern with prefixes and the handler with middlewares.
func (*Mux) PrintRegisteredPatterns ¶
func (mux *Mux) PrintRegisteredPatterns()
PrintRegisteredPatterns prints the registered patterns of the http.ServeMux. The Build() method needs to be called before!