Documentation ¶
Index ¶
- type Server
- func (s *Server) AcceptConnections() error
- func (s *Server) LivenessCheck()
- func (s *Server) OpenListener() (net.Listener, error)
- func (s *Server) RecoverHandler(next http.Handler) http.Handler
- func (s *Server) RegisterHandlers()
- func (s *Server) ServeStatic(key string) http.HandlerFunc
- func (s *Server) WrapRoute(h http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { *config.Config *mux.Router *http.Server // contains filtered or unexported fields }
Server represents the running server with embedded *http.Server, *mux.Router, zerolog.Logger instances manages the configurations, starting, stopping and routing of HTTP server instance
func (*Server) AcceptConnections ¶
AcceptConnections listens on the configured address and ports for http traffic. Simultaneously listens for incoming os signals, will return on either a server error or a shutdown signal
func (*Server) LivenessCheck ¶
func (s *Server) LivenessCheck()
LivenessCheck retrieves home page to verify the liveness of the server, then notifies the systemd daemon to pass the check.
func (*Server) OpenListener ¶
OpenListener returns a listener for the server to receive traffic on, or err
func (*Server) RecoverHandler ¶
RecoverHandler catches panics in downstream handlers, sends an error to gracefully alert the client
func (*Server) RegisterHandlers ¶
func (s *Server) RegisterHandlers()
RegisterHandlers attemtps to prepare and register the specified routes with the given middlewware on the server instance.
func (*Server) ServeStatic ¶
func (s *Server) ServeStatic(key string) http.HandlerFunc
ServeStatic prepares and returns a http.Handler serving a single file
func (*Server) WrapRoute ¶
func (s *Server) WrapRoute(h http.HandlerFunc) http.HandlerFunc
WrapRoute composes endpoints by wrapping destination handler with handler pipeline providing tracing with aws x-ray, injecting logging middleware with request details into the context, and error recovery middleware, and gzipping the response