router

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UNIQS *luniq.Uniq = luniq.New()

Functions

func Redirect

func Redirect(from, to string, code int)

func Register

func Register(method string, path string, fn HANDLER)

func RegisterJsonRPC

func RegisterJsonRPC(url string)

func ServeHTTP

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

func SetDefault

func SetDefault(rt *Router)

Types

type HANDLER

type HANDLER func(rw http.ResponseWriter, r *http.Request, params Params)

type Params

type Params map[string]string

func (Params) GetBool

func (p Params) GetBool(name string) bool

func (Params) GetFloat

func (p Params) GetFloat(name string) float64

func (Params) GetInt

func (p Params) GetInt(name string) int64

func (Params) GetString

func (p Params) GetString(name string) string

type Router

type Router struct {
	NotFoundFunc      http.HandlerFunc
	BadRequestFunc    http.HandlerFunc
	InternalErrorFunc http.HandlerFunc
	OptionsFunc       http.HandlerFunc
	LoggerFunc        log.LoggerFunc
	MakeUid           bool
	// contains filtered or unexported fields
}

func GetDefault

func GetDefault() *Router

func New

func New(isDefault bool) *Router

func (*Router) Redirect

func (r *Router) Redirect(from, to string, code int)

func (*Router) Register

func (r *Router) Register(method string, path string, fn HANDLER)

func (*Router) RegisterJsonRPC

func (r *Router) RegisterJsonRPC(url string)

func (*Router) ServeHTTP

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

Jump to

Keyboard shortcuts

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