router

package
v4.46.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParams

func GetParams(r *http.Request) map[string]string

GetParams of a request

Types

type Router

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

Router with path management

func NewRouter

func NewRouter() Router

NewRouter creates a new empty Router

func (Router) AddRoute

func (r Router) AddRoute(method, pattern string, handler http.Handler) Router

AddRoute for given method and pattern. Pattern must startss with a slash, should not contains trailing slash. Path variable must be prefixed with ':', next to the slash separator Glob variable must be prefixed with '*', next to the slash separator, at the end of the pattern

func (Router) Any added in v4.41.6

func (r Router) Any(pattern string, handler http.Handler) Router

Any configure route for any method in the specs

func (Router) Connect

func (r Router) Connect(pattern string, handler http.Handler) Router

Connect configure route for CONNECT method

func (Router) DefaultHandler

func (r Router) DefaultHandler(handler http.Handler) Router

DefaultHandler sets default handler when no route is not found

func (Router) Delete

func (r Router) Delete(pattern string, handler http.Handler) Router

Delete configure route for DELETE method

func (Router) Get

func (r Router) Get(pattern string, handler http.Handler) Router

Get configure route for GET method

func (Router) Handler

func (r Router) Handler() http.Handler

Handler for request. Should be use with net/http

func (Router) Head

func (r Router) Head(pattern string, handler http.Handler) Router

Head configure route for HEAD method

func (Router) Options

func (r Router) Options(pattern string, handler http.Handler) Router

Options configure route for OPTIONS method

func (Router) Patch

func (r Router) Patch(pattern string, handler http.Handler) Router

Patch configure route for PATCH method

func (Router) Post

func (r Router) Post(pattern string, handler http.Handler) Router

Post configure route for POST method

func (Router) Put

func (r Router) Put(pattern string, handler http.Handler) Router

Put configure route for PUT method

func (Router) Trace

func (r Router) Trace(pattern string, handler http.Handler) Router

Trace configure route for TRACE method

Jump to

Keyboard shortcuts

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