routes

package
v0.0.0-...-a669293 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2014 License: BSD-2-Clause-Views Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCanonical

func IsCanonical(p string) (string, bool)

func Re

func Re(expr string) func(h HandlerFunc) Route

func ReCap

func ReCap(expr string) func(h interface{}) Route

func Static

func Static(expr string) func(h HandlerFunc) Route

func Wildcard

func Wildcard() func(h HandlerFunc) Route

Types

type Context

type Context struct {
	*http.Request
	Response http.ResponseWriter
	Params   Params
}

func NewContext

func NewContext(w http.ResponseWriter, r *http.Request) Context

func (*Context) Error

func (c *Context) Error(status int)

func (*Context) Redirect

func (c *Context) Redirect(path string)

func (*Context) RedirectPerm

func (c *Context) RedirectPerm(path string)

type HandlerFunc

type HandlerFunc func(ctx Context)

func Wrap

func Wrap(fn http.HandlerFunc) HandlerFunc

type Params

type Params func() map[string]string

type Route

type Route interface {
	Path() string
	IsCanonical(path string) (string, bool)
	Matches(path string) bool
	Execute(ctx Context)
}

func NewRe

func NewRe(expr string, h HandlerFunc) Route

func NewReCap

func NewReCap(expr string, h interface{}) Route

func NewStatic

func NewStatic(path string, h HandlerFunc) Route

func NewWildcard

func NewWildcard(h HandlerFunc) Route

type Routes

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

func New

func New() *Routes

func (*Routes) Add

func (s *Routes) Add(r Route, methods ...string) error

func (*Routes) Connect

func (s *Routes) Connect(r Route) *Routes

func (*Routes) Delete

func (s *Routes) Delete(r Route) *Routes

func (*Routes) Get

func (s *Routes) Get(r Route) *Routes

func (*Routes) Head

func (s *Routes) Head(r Route) *Routes

func (*Routes) Options

func (s *Routes) Options(r Route) *Routes

func (*Routes) Post

func (s *Routes) Post(r Route) *Routes

func (*Routes) Put

func (s *Routes) Put(r Route) *Routes

func (*Routes) ServeHTTP

func (s *Routes) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Routes) Trace

func (s *Routes) Trace(r Route) *Routes

Jump to

Keyboard shortcuts

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