router

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: CC0-1.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileServer

func FileServer(r chi.Router, public string, static string)

FileServer is serving static files

Types

type ChiRouter

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

func NewChiRouter

func NewChiRouter(timeout ...int) *ChiRouter

func (*ChiRouter) Delete

func (cr *ChiRouter) Delete(pattern string, handler WrapperFunc)

func (*ChiRouter) Get

func (cr *ChiRouter) Get(pattern string, handler WrapperFunc)

func (*ChiRouter) GetHandler

func (cr *ChiRouter) GetHandler() *chi.Mux

func (*ChiRouter) Group

func (cr *ChiRouter) Group(prefix string, fn func(r RouteInterface)) RouteInterface

func (*ChiRouter) Handle

func (cr *ChiRouter) Handle(pattern string, handler http.Handler)

func (*ChiRouter) InitRoute added in v0.4.1

func (cr *ChiRouter) InitRoute(corsConfig ...cors.Options)

func (*ChiRouter) Match

func (cr *ChiRouter) Match(rctx *chi.Context, method, path string) bool

Match(rctx *Context, method, path string) bool

func (*ChiRouter) Middlewares

func (cr *ChiRouter) Middlewares() chi.Middlewares

func (*ChiRouter) Mount

func (cr *ChiRouter) Mount(pattern string, handler http.Handler)

func (*ChiRouter) Patch

func (cr *ChiRouter) Patch(pattern string, handler WrapperFunc)

func (*ChiRouter) Post

func (cr *ChiRouter) Post(pattern string, handler WrapperFunc)

func (*ChiRouter) Put

func (cr *ChiRouter) Put(pattern string, handler WrapperFunc)

func (*ChiRouter) Routes

func (cr *ChiRouter) Routes() []chi.Route

func (*ChiRouter) ServeHTTP

func (cr *ChiRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ChiRouter) StaticFS

func (cr *ChiRouter) StaticFS(pattern, imgDir string)

func (*ChiRouter) Use

func (cr *ChiRouter) Use(middlewares ...func(http.Handler) http.Handler)

func (*ChiRouter) With

func (cr *ChiRouter) With(middlewares ...func(http.Handler) http.Handler) RouteInterface

type RouteInterface

type RouteInterface interface {
	chi.Routes
	GetHandler() *chi.Mux
	InitRoute(corsConfig ...cors.Options)
	Handle(pattern string, handler http.Handler)
	Group(prefix string, fn func(r RouteInterface)) RouteInterface
	Get(pattern string, handler WrapperFunc)
	Post(pattern string, handler WrapperFunc)
	Patch(pattern string, handler WrapperFunc)
	Delete(pattern string, handler WrapperFunc)
	Put(pattern string, handler WrapperFunc)
	Use(middlewares ...func(http.Handler) http.Handler)
	With(middlewares ...func(http.Handler) http.Handler) RouteInterface
	Mount(pattern string, handler http.Handler)
	StaticFS(pattern, imgDir string)
}

type WrapperFunc

type WrapperFunc func(http.ResponseWriter, *http.Request) *response.JSON

Jump to

Keyboard shortcuts

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