router

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

README

modulus-router-httprouter

This is a router module for the Modulus framework. It uses amazing fast github.com/julienschmidt/httprouter

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModuleConfig

type ModuleConfig struct {
	Routes                 Routes
	Port                   int
	RedirectTrailingSlash  bool
	RedirectFixedPath      bool
	HandleMethodNotAllowed bool
	HandleOPTIONS          bool
	GlobalOPTIONS          http.Handler
	NotFound               http.Handler
	MethodNotAllowed       http.Handler
	PanicHandler           func(http.ResponseWriter, *http.Request, interface{})
	// contains filtered or unexported fields
}

func NewModuleConfig

func NewModuleConfig() *ModuleConfig

func (*ModuleConfig) InitConfig

func (c *ModuleConfig) InitConfig(config application.Config) error

func (*ModuleConfig) OnStart

func (c *ModuleConfig) OnStart() error

func (*ModuleConfig) ProvidedServices

func (c *ModuleConfig) ProvidedServices() []interface{}

func (*ModuleConfig) SetContainer

func (c *ModuleConfig) SetContainer(container *dig.Container)

type Router

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

func NewRouter

func NewRouter(config *ModuleConfig, logger application.Logger) *Router

func (*Router) AddRoutes

func (r *Router) AddRoutes(routes []application.RouteInfo)

func (*Router) RouteParams

func (r *Router) RouteParams(request *http.Request) url.Values

func (*Router) Run

func (r *Router) Run() error

type Routes

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

func NewRoutes

func NewRoutes() *Routes

func (*Routes) AddFromRoutes

func (r *Routes) AddFromRoutes(routes *Routes)

func (*Routes) Delete

func (r *Routes) Delete(name string, path string, handler http.HandlerFunc)

func (*Routes) Get

func (r *Routes) Get(name string, path string, handler http.HandlerFunc)

func (*Routes) GetRoutesInfo

func (r *Routes) GetRoutesInfo() []application.RouteInfo

func (*Routes) Options

func (r *Routes) Options(name string, path string, handler http.HandlerFunc)

func (*Routes) Post

func (r *Routes) Post(name string, path string, handler http.HandlerFunc)

func (*Routes) Put

func (r *Routes) Put(name string, path string, handler http.HandlerFunc)

type ServiceProvider

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

func NewServiceProvider

func NewServiceProvider(config *ModuleConfig) *ServiceProvider

func (*ServiceProvider) InitConfig

func (s *ServiceProvider) InitConfig(config application.Config) error

func (*ServiceProvider) OnClose

func (s *ServiceProvider) OnClose() error

func (*ServiceProvider) OnStart

func (s *ServiceProvider) OnStart() error

func (*ServiceProvider) Provide

func (s *ServiceProvider) Provide() []interface{}

func (*ServiceProvider) SetContainer

func (s *ServiceProvider) SetContainer(container *dig.Container)

Jump to

Keyboard shortcuts

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