router

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProviderProductionSet provides a new Router for use in production.
	ProviderProductionSet = wire.NewSet(Provide, Cfg, handlers.ProvideHandlerManager, validator.ProviderSet)

	// ProviderTestSet provides a new Router for use in testing.
	ProviderTestSet = wire.NewSet(Provide, CfgTest)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Environment    string
	Middleware     []gin.HandlerFunc
	HandlerManager *handlers.HandlerManager
	RootEndpoint   string
	Validator      *validator.Validator
}

Config contains the parameters for configuring a Router.

func Cfg

func Cfg(v *viper.Viper, middleware []gin.HandlerFunc, handlerManager *handlers.HandlerManager, validator *validator.Validator) (*Config, error)

Cfg provides a new Config using values from a Viper and contains the given middleware and handlers.

func CfgTest

func CfgTest(cfg Config) (*Config, error)

CfgTest provides the passed Config.

type Router

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

Router contains the engine and Config for routing requests.

func New

func New(cfg Config) *Router

New returns a new instance of Router configured with the given Config.

func Provide

func Provide(cfg *Config) *Router

Provide provides a new Router using the given Config.

func (*Router) Run

func (r *Router) Run(address string) error

Run runs the router's engine.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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