chi

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ChiDefaultDebugPattern = "/__debug/"

ChiDefaultDebugPattern is the default pattern used to define the debug endpoint

Variables

This section is empty.

Functions

func DefaultFactory

func DefaultFactory(proxyFactory proxy.Factory, logger logging.Logger) router.Factory

DefaultFactory returns a chi router factory with the injected proxy factory and logger. It also uses a default chi router and the default HandlerFactory

func NewEndpointHandler

func NewEndpointHandler(cfg *config.EndpointConfig, prxy proxy.Proxy) http.HandlerFunc

NewEndpointHandler implements the HandleFactory interface using the default ToHTTPError function

func NewFactory

func NewFactory(cfg Config) router.Factory

NewFactory returns a chi router factory with the injected configuration

Types

type Config

type Config struct {
	Engine         chi.Router
	Middlewares    chi.Middlewares
	HandlerFactory HandlerFactory
	ProxyFactory   proxy.Factory
	Logger         logging.Logger
	DebugPattern   string
	RunServer      RunServerFunc
}

Config is the struct that collects the parts the router should be builded from

type HandlerFactory

type HandlerFactory func(*config.EndpointConfig, proxy.Proxy) http.HandlerFunc

HandlerFactory creates a handler function that adapts the chi router with the injected proxy

type RunServerFunc

type RunServerFunc func(context.Context, config.ServiceConfig, http.Handler) error

RunServerFunc is a func that will run the http Server with the given params.

Jump to

Keyboard shortcuts

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