router

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Writer  http.ResponseWriter
	Request *http.Request

	Params map[string]string
	// contains filtered or unexported fields
}

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithError

func (c *Context) AbortWithError(code int, err error)

func (*Context) BindBody

func (c *Context) BindBody(v interface{}) error

func (*Context) Header

func (c *Context) Header(key, value string)

func (*Context) JSON

func (c *Context) JSON(code int, body interface{})

func (*Context) Param

func (c *Context) Param(key string) string

func (*Context) Query

func (c *Context) Query(key string) string

func (*Context) Status

func (c *Context) Status(code int)

func (*Context) Text

func (c *Context) Text(code int, body string)

type Handler

type Handler func(*Context)

type Route

type Route struct {
	Method  string
	Pattern *regexp.Regexp
	Handler Handler
}

type Router

type Router struct {
	Routes       []*Route
	DefaultRoute Handler
	// contains filtered or unexported fields
}

func New

func New() *Router

func (*Router) Handle

func (r *Router) Handle(method, pattern string, handler Handler)

func (*Router) ServeHTTP

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

func (*Router) Use

func (r *Router) Use(handler Handler)

Jump to

Keyboard shortcuts

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