router

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPath

func CleanPath(p string) string

Types

type Chain

type Chain struct {
	Middlewares []context.MiddlewareInterface
	Action      context.ActionInterface
	// contains filtered or unexported fields
}

type Default

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

func NewDefault

func NewDefault(m string, p string, a context.ActionInterface) *Default

func (*Default) Chain

func (d *Default) Chain() *Chain

func (*Default) Method

func (d *Default) Method() string

func (*Default) Middleware

func (d *Default) Middleware(middlewares ...context.MiddlewareInterface)

func (*Default) Path

func (d *Default) Path() string

type RouterInterface

type RouterInterface interface {
	Method() string
	Path() string
	Chain() *Chain
	Middleware(...context.MiddlewareInterface)
}

type Routers

type Routers struct {
	SaveMatchedRoutePath   bool
	RedirectTrailingSlash  bool
	RedirectFixedPath      bool
	HandleMethodNotAllowed bool
	HandleOPTIONS          bool
	GlobalOPTIONS          *Chain

	NotFound         *Chain
	MethodNotAllowed *Chain
	// contains filtered or unexported fields
}

func NewRouters

func NewRouters() *Routers

func (*Routers) Add

func (r *Routers) Add(router RouterInterface)

func (*Routers) Handle

func (r *Routers) Handle(method, path string, chain *Chain)

func (*Routers) HandleHTTP

func (r *Routers) HandleHTTP(c *context.Context)

func (*Routers) Lookup

func (r *Routers) Lookup(method, path string) (*Chain, context.Params, bool)

func (*Routers) Middlerware

func (r *Routers) Middlerware(middlewares ...context.MiddlewareInterface)

func (*Routers) ServeFiles

func (r *Routers) ServeFiles(path string, root http.FileSystem, chain *Chain)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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