Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewZapLogger ¶ added in v0.0.26
func NewZapLogger(development, verbose bool, logFile string) (*zap.SugaredLogger, error)
Types ¶
type AppEndpoint ¶ added in v0.0.25
type AppEndpoint struct { Handler AppHandler Server *Server }
func (AppEndpoint) ServeHTTP ¶ added in v0.0.25
func (a AppEndpoint) ServeHTTP(w http.ResponseWriter, r *http.Request)
type AppHandler ¶ added in v0.0.25
type AppHandler func(http.ResponseWriter, *http.Request) error
type EndpointMetricsMiddleware ¶ added in v0.0.20
type EndpointMetricsMiddleware struct {
MetricsCollector middleware.Middleware
}
func (*EndpointMetricsMiddleware) AddMiddleware ¶ added in v0.0.20
type Error ¶
Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.
type PerRouteMiddleware ¶ added in v0.0.20
PerRouteMiddleware adds middleware that requires information about the specific paths used (e.g. HTTP metric collection, which needs to know what path a given function is registered to).
type Server ¶
type Server struct { ServerConfig Info ServerInfo PerRouteMiddlewares []PerRouteMiddleware Logger *zap.SugaredLogger Router *httprouter.Router MaxShutdownTime time.Duration IsHealthy int32 // contains filtered or unexported fields }
Server describes the server configuration
func NewServer ¶ added in v0.0.26
func NewServer(config ServerConfig, info ServerInfo) *Server
func (*Server) AddEndpoint ¶ added in v0.0.25
func (s *Server) AddEndpoint(h AppHandler) *AppEndpoint
type ServerConfig ¶ added in v0.0.26
type ServerConfig struct { LogFile string Port int `valid:"range(1|65535)~'port' must be a valid port between 1-65535, required~Port must be specified"` Development bool Verbose bool }
ServerConfig contains all the configuration options for the server. Everything here should be operator-accessible
type ServerInfo ¶ added in v0.0.4
ServerInfo contains some metadata about the server. This information is typically baked in at compile time, so in most development cases these fields will be empty.
type StatusError ¶
StatusError represents an error with an associated HTTP status code.
func (StatusError) Error ¶
func (se StatusError) Error() string
Allows StatusError to satisfy the error interface.
type SubRouter ¶ added in v0.0.20
type SubRouter struct { // The full path prefix that this SubRouter is adding to Path string // The router to add routes to Server *Server // Middleware to append to all child routes. These get appended to an extra subroutes Middlewares []Middleware }
func (*SubRouter) AddMiddleware ¶ added in v0.0.20
func (s *SubRouter) AddMiddleware(m ...Middleware)
func (*SubRouter) RouteFiles ¶ added in v0.0.20
func (s *SubRouter) RouteFiles(path string, root http.FileSystem)