Documentation ¶
Overview ¶
Package gin provides some basic implementations for building routers based on gin-gonic/gin
Index ¶
- Constants
- func CustomErrorEndpointHandler(configuration *config.EndpointConfig, prxy proxy.Proxy, ...) gin.HandlerFunc
- 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(headersToSend []string) func(*gin.Context, []string) *proxy.Request
- func RegisterRender(name string, r Render)
- type Config
- type HandlerFactory
- type Render
- type RunServerFunc
Constants ¶
const NEGOTIATE = "negotiate"
NEGOTIATE defines the value of the OutputEncoding for the negotiated render
Variables ¶
This section is empty.
Functions ¶
func CustomErrorEndpointHandler ¶
func CustomErrorEndpointHandler(configuration *config.EndpointConfig, prxy proxy.Proxy, errF router.ToHTTPError) gin.HandlerFunc
CustomErrorEndpointHandler implements the HandleFactory interface
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 using the default ToHTTPError function
func NewFactory ¶
NewFactory returns a gin router factory with the injected configuration
func NewRequest ¶
NewRequest gets a request from the current gin context and the received query string
func RegisterRender ¶
RegisterRender allows clients to register their custom renders
Types ¶
type Config ¶
type Config struct { Engine *gin.Engine Middlewares []gin.HandlerFunc HandlerFactory HandlerFactory ProxyFactory proxy.Factory Logger logging.Logger 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) gin.HandlerFunc
HandlerFactory creates a handler function that adapts the gin router with the injected proxy
type Render ¶
Render defines the signature of the functions to be use for the final response encoding and rendering
type RunServerFunc ¶
RunServerFunc is a func that will run the http Server with the given params.