routing

package
v0.0.0-...-8d921ee Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2015 License: MIT, MIT Imports: 7 Imported by: 0

README

routing

Simple http routing in go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MethodNotAllowed

func MethodNotAllowed(remainingPath string, resp http.ResponseWriter, req *http.Request) bool

func RouteHandlerFunc

func RouteHandlerFunc(matcher Matcher) func(http.ResponseWriter, *http.Request)

func TestPrefix

func TestPrefix(t *testing.T)

Types

type Matcher

type Matcher func(remainingPath string, resp http.ResponseWriter, req *http.Request) bool

func Any

func Any(handler http.Handler) Matcher

func AnyFunc

func AnyFunc(handler func(http.ResponseWriter, *http.Request)) Matcher

func DELETE

func DELETE(handler http.Handler) Matcher

func DELETEFunc

func DELETEFunc(handler func(http.ResponseWriter, *http.Request)) Matcher

func End

func End(subMatcher Matcher) Matcher

func EndSeq

func EndSeq(subMatchers ...Matcher) Matcher

func GET

func GET(handler http.Handler) Matcher

func GETFunc

func GETFunc(handler func(http.ResponseWriter, *http.Request)) Matcher

func IntPart

func IntPart(matcherForPart func(int) Matcher) Matcher

func Method

func Method(method string, handler http.Handler) Matcher

func POST

func POST(handler http.Handler) Matcher

func POSTFunc

func POSTFunc(handler func(http.ResponseWriter, *http.Request)) Matcher

func PUT

func PUT(handler http.Handler) Matcher

func PUTFunc

func PUTFunc(handler func(http.ResponseWriter, *http.Request)) Matcher

func Prefix

func Prefix(prefix string, subMatcher Matcher) Matcher

func PrefixSeq

func PrefixSeq(prefix string, subMatchers ...Matcher) Matcher

func Sequence

func Sequence(matchers ...Matcher) Matcher

func StringPart

func StringPart(matcherForPart func(string) Matcher) Matcher

type RouteHandler

type RouteHandler struct {
	Matcher Matcher
}

func NewRouteHandler

func NewRouteHandler(matchers ...Matcher) *RouteHandler

func (*RouteHandler) ServeHTTP

func (r *RouteHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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