Documentation ¶
Overview ¶
Package ginx provides shared functions used with gin to help reduce code duplication using an opinionated gin server setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultServerShutdownTimeout sets the default for how long we give the sever // to shutdown before forcefully stopping the server. DefaultServerShutdownTimeout = 5 * time.Second )
Functions ¶
func DefaultEngine ¶
DefaultEngine returns a base gin engine for processing requests. This setups logging, requestid, and otel middleware.
Types ¶
type Config ¶
type Config struct {
Listen string `mapstructure:"listen"`
}
Config is used to configure a new ginx server
type Server ¶
Server implements the HTTP Server
func (Server) AddHandler ¶
AddHandler provides the ability to add additional HTTP handlers that process requests. The handler that is provided should have a Routes(*gin.RouterGroup) function, which allows the routes to be added to the server.
func (Server) AddReadinessCheck ¶
AddReadinessCheck will accept a function to be ran during calls to /readyx. These functions should accept a context and only return an error. When adding a readiness check a name is also provided, this name will be used when returning the state of all the checks