Documentation ¶
Overview ¶
Package gin provides some basic implementations for building routers based on gin-gonic/gin
Index ¶
- Variables
- func DebugHandler(logger logging.Logger) gin.HandlerFunc
- func DefaultFactory(proxyFactory proxy.Factory, logger logging.Logger) router.Factory
- func EndpointHandler(configuration *config.EndpointConfig, proxy proxy.Proxy) gin.HandlerFunc
- func NewFactory(cfg Config) router.Factory
- func NewRequest(c *gin.Context, queryString []string) *proxy.Request
- type Config
- type HandlerFactory
Constants ¶
This section is empty.
Variables ¶
var ErrInternalError = errors.New("internal server error")
ErrInternalError is the error returned by the router when something went wrong
Functions ¶
func DebugHandler ¶
func DebugHandler(logger logging.Logger) gin.HandlerFunc
DebugHandler creates a dummy handler function, useful for quick integration tests
func DefaultFactory ¶
DefaultFactory returns a gin router factory with the injected proxy factory and logger. It also uses a default gin router and the default HandlerFactory
func EndpointHandler ¶
func EndpointHandler(configuration *config.EndpointConfig, proxy proxy.Proxy) gin.HandlerFunc
EndpointHandler implements the HandleFactory interface
func NewFactory ¶
NewFactory returns a gin router factory with the injected configuration
Types ¶
type Config ¶
type Config struct { Engine *gin.Engine Middlewares []gin.HandlerFunc HandlerFactory HandlerFactory ProxyFactory proxy.Factory Logger logging.Logger }
Config is the struct that collects the parts the router should be builded from
type HandlerFactory ¶
type HandlerFactory func(*config.EndpointConfig, proxy.Proxy) gin.HandlerFunc
HandlerFactory creates a handler function that adapts the gin router with the injected proxy