router

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHttpParam

func GetHttpParam(ctx context.Context, name string) string

func GetResponseWriter

func GetResponseWriter(ctx context.Context) http.ResponseWriter

Types

type Handle

type Handle func(*http.Request) *response.JSONResponse

type MyRouter

type MyRouter struct {
	Httprouter     *httprouter.Router
	WrappedHandler http.Handler
	Options        *Options
	// contains filtered or unexported fields
}

func New

func New(o *Options) *MyRouter

func (*MyRouter) DELETE

func (mr *MyRouter) DELETE(path string, handle Handle)

func (*MyRouter) GET

func (mr *MyRouter) GET(path string, handle Handle)

func (*MyRouter) Group

func (mr *MyRouter) Group(path string, fn func(r *MyRouter))

func (*MyRouter) Handle

func (mr *MyRouter) Handle(path, method string, handle Handle)

func (*MyRouter) Handler

func (mr *MyRouter) Handler(path, method string, handler http.Handler)

func (*MyRouter) HttpHandler deprecated

func (mr *MyRouter) HttpHandler() http.Handler

Deprecated: use MyRouter instead, it's already implement http.Handler

func (*MyRouter) PATCH

func (mr *MyRouter) PATCH(path string, handle Handle)

func (*MyRouter) POST

func (mr *MyRouter) POST(path string, handle Handle)

func (*MyRouter) PUT

func (mr *MyRouter) PUT(path string, handle Handle)

func (*MyRouter) ServeFiles

func (mr *MyRouter) ServeFiles(path string, root http.FileSystem)

func (*MyRouter) ServeHTTP

func (mr *MyRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Options

type Options struct {
	Prefix  string
	Timeout int
}

Jump to

Keyboard shortcuts

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