Version: v0.0.0-...-95bd64c Latest Latest

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

Go to latest
Published: Jun 15, 2015 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func Context

func Context(r *http.Request) context.Context

Context returns the context for the request.

func FileServe

func FileServe(dir string) http.HandlerFunc

FileServe returns a new http.HandlerFunc that serves files from dir. Using routes must provide the *filepath parameter.

func Param

func Param(ctx context.Context, p string) string

Param returns param p for the context.

func WithParam

func WithParam(ctx context.Context, p, v string) context.Context

WithParam returns a new context with param p set to v.


type Router

type Router struct {
	// contains filtered or unexported fields

Router wraps httprouter.Router and adds support for prefixed sub-routers.

func New

func New() *Router

New returns a new Router.

func (*Router) Del

func (r *Router) Del(path string, h http.HandlerFunc)

Del registers a new DELETE route.

func (*Router) Get

func (r *Router) Get(path string, h http.HandlerFunc)

Get registers a new GET route.

func (*Router) Post

func (r *Router) Post(path string, h http.HandlerFunc)

Post registers a new POST route.

func (*Router) ServeHTTP

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

ServeHTTP implements http.Handler.

func (*Router) WithPrefix

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

WithPrefix returns a router that prefixes all registered routes with prefix.

Source Files

Jump to

Keyboard shortcuts

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