router

package
v0.0.0-...-f3a3c3f Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: MIT Imports: 5 Imported by: 1

README

copy code from httprouter

Documentation

Index

Constants

View Source
const (
	GET     = "GET"
	POST    = "POST"
	PUT     = "PUT"
	PATCH   = "PATCH"
	OPTIONS = "OPTIONS"
	DELETE  = "DELETE"
)

Variables

This section is empty.

Functions

func FetchParams

func FetchParams(ctx context.Context) (ps tree.Params, ok bool)

Types

type Router

type Router struct {
	RedirectTrailingSlash  bool
	RedirectFixedPath      bool
	HandleMethodNotAllowed bool

	MethodNotAllowed xrest.Handler
	NotFound         xrest.Handler
	// contains filtered or unexported fields
}

func New

func New() *Router

func (*Router) Delete

func (r *Router) Delete(path string, h xrest.Handler)

func (*Router) Get

func (r *Router) Get(path string, h xrest.Handler)

func (*Router) Options

func (r *Router) Options(path string, h xrest.Handler)

func (*Router) Patch

func (r *Router) Patch(path string, h xrest.Handler)

func (*Router) Plug

func (r *Router) Plug(_ xrest.Handler) xrest.Handler

func (*Router) Post

func (r *Router) Post(path string, h xrest.Handler)

func (*Router) Put

func (r *Router) Put(path string, h xrest.Handler)

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(ctx context.Context, w http.ResponseWriter, req *http.Request)

func (*Router) SubRouter

func (r *Router) SubRouter(prefix string) *SubRouter

type SubRouter

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

func (*SubRouter) Delete

func (sr *SubRouter) Delete(path string, h xrest.Handler)

func (*SubRouter) Get

func (sr *SubRouter) Get(path string, h xrest.Handler)

func (*SubRouter) Options

func (sr *SubRouter) Options(path string, h xrest.Handler)

func (*SubRouter) Patch

func (sr *SubRouter) Patch(path string, h xrest.Handler)

func (*SubRouter) Plug

func (sr *SubRouter) Plug(plug ...xrest.Plugger)

func (*SubRouter) Post

func (sr *SubRouter) Post(path string, h xrest.Handler)

func (*SubRouter) Put

func (sr *SubRouter) Put(path string, h xrest.Handler)

func (*SubRouter) SubRouter

func (sr *SubRouter) SubRouter(prefix string) *SubRouter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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