mux

package module
v0.0.0-...-9635c1c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: MIT Imports: 1 Imported by: 0

README

mux

Package mux provides HTTP routing tools

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct{}

func (*Mock) Add

func (*Mock) Add(string, http.Handler) error

func (*Mock) Get

func (*Mock) Get(string) (http.Handler, map[string]string, bool)

type Node

type Node interface {
	Add(string, http.Handler) error
	Get(string) (http.Handler, map[string]string, bool)
}

Node interface.

type Router

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

Router represents simple router with configurable route tree.

func NewRouter

func NewRouter(nf func() Node) *Router

NewRouter creates a Router.

func (*Router) Handle

func (mux *Router) Handle(method, pattern string, handler http.Handler) error

Handle registers a new request handle with the given path and method.

func (*Router) ServeHTTP

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

Jump to

Keyboard shortcuts

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