Versions in this module Expand all Collapse all v0 v0.0.1 Apr 29, 2019 Changes in this version + var ErrServerAlreadyRunning = errors.New("common/server: already running") + var ErrServerStopped = errors.New("common/server: not running") + func HealthHandler(metrics *[]HealthMetric) httprouter.Handle + func InfoHandler(metrics *[]InfoMetric) httprouter.Handle + func MethodNotAllowedHandler() http.HandlerFunc + func NotFoundHandler() http.HandlerFunc + func PanicHandler() func(http.ResponseWriter, *http.Request, interface{}) + func RouteHandler(routes *[]RouteInfo) httprouter.Handle + type HealthMetric struct + GetValue HealthMetricHandler + Name string + type HealthMetricHandler func() HealthMetricResult + type HealthMetricResult struct + Info map[string]interface{} + OK bool + Status string + type HealthResponse struct + Metrics map[string]HealthMetricResult + Status string + type InfoMetric struct + GetValue InfoMetricHandler + Name string + type InfoMetricHandler func() interface + type InfoResponse struct + GC InfoResponseGC + Goroutines int + MemUsed string + Metrics map[string]interface{} + NumCPU int + Uptime string + type InfoResponseGC struct + CPUUsage string + Enabled bool + NextRun string + Runs uint32 + Time string + type Option struct + func OptionAppEnv(envName string) Option + func OptionContextPath(path string) Option + type RouteInfo struct + Method string + Path string + type Server struct + func New(opts ...Option) *Server + func (s *Server) AddInfoMetric(name string, handler InfoMetricHandler) + func (s *Server) AddLivenessCheck(name string, handler HealthMetricHandler) + func (s *Server) AddReadinessCheck(name string, handler HealthMetricHandler) + func (s *Server) DELETE(path string, handle httprouter.Handle) + func (s *Server) GET(path string, handle httprouter.Handle) + func (s *Server) HEAD(path string, handle httprouter.Handle) + func (s *Server) Handle(method, path string, handle httprouter.Handle) + func (s *Server) OPTIONS(path string, handle httprouter.Handle) + func (s *Server) PATCH(path string, handle httprouter.Handle) + func (s *Server) POST(path string, handle httprouter.Handle) + func (s *Server) PUT(path string, handle httprouter.Handle) + func (s *Server) Run(addr string) error + func (s *Server) Shutdown() (err error) + func (s Server) IsRunning() bool