Documentation ¶
Index ¶
- func CORS(c *gin.Context)
- func Recover() gin.HandlerFunc
- func RequestLog() gin.HandlerFunc
- func Trace(traceHeader string) gin.HandlerFunc
- type Server
- func (server *Server) AddShutdownHook(hook func()) *Server
- func (server *Server) AddStartHook(hook func()) *Server
- func (server *Server) EnableAvailableHealthCheck() *Server
- func (server *Server) EnableCorsMiddleware() *Server
- func (server *Server) EnablePprofHandler() *Server
- func (server *Server) EnableReleaseMode() *Server
- func (server *Server) EnableSwaggerHandler() *Server
- func (server *Server) EnableTraceMiddleware(traceHeader string) *Server
- func (server *Server) EnableTracing(service, address string) *Server
- func (server *Server) RegisterRouteLoader(loader func(router *gin.Engine)) *Server
- func (server *Server) Run(stop <-chan struct{})
- func (server *Server) Shutdown()
- func (server *Server) WithDefaultRecoverMiddleware() *Server
- func (server *Server) WithDefaultRequestLogMiddleware() *Server
- func (server *Server) WithNotFoundHandler(notFoundHandler ...gin.HandlerFunc) *Server
- func (server *Server) WithTLSConfig(cfg *tls.Config) *Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Recover ¶
func Recover() gin.HandlerFunc
func RequestLog ¶
func RequestLog() gin.HandlerFunc
func Trace ¶
func Trace(traceHeader string) gin.HandlerFunc
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an HTTP server.
func (*Server) AddShutdownHook ¶
AddShutdownHook adds a callback function what's called before the server is shutdown
func (*Server) AddStartHook ¶
AddStartHook adds a hook function what's called before server is start
func (*Server) EnableAvailableHealthCheck ¶
EnableAvailableHealthCheck enables the health check
func (*Server) EnableCorsMiddleware ¶
EnableCorsMiddleware enables cors middleware
func (*Server) EnablePprofHandler ¶
EnablePprofHandler enables the profiler for the http server
func (*Server) EnableReleaseMode ¶
EnableReleaseMode enables the release mode for the http server,it will hide the route tables
func (*Server) EnableSwaggerHandler ¶
EnableSwaggerHandler enables the swagger handler for the http server
func (*Server) EnableTraceMiddleware ¶
EnableTraceMiddleware enables trace middleware with trace header name
func (*Server) EnableTracing ¶ added in v1.1.4
EnableTracing enables tracing of jaeger
func (*Server) RegisterRouteLoader ¶
RegisterRouteLoader registers a route loader
func (*Server) Run ¶ added in v1.1.9
func (server *Server) Run(stop <-chan struct{})
Run starts the server.
func (*Server) WithDefaultRecoverMiddleware ¶
WithDefaultRecoverMiddleware enables default recover middleware
func (*Server) WithDefaultRequestLogMiddleware ¶
WithDefaultRequestLogMiddleware enables the default request log middleware.
func (*Server) WithNotFoundHandler ¶
func (server *Server) WithNotFoundHandler(notFoundHandler ...gin.HandlerFunc) *Server
WithNotFoundHandler provide the handler for not found routes and methods