Documentation
¶
Overview ¶
Package http provides the backbone for an HTTP server with some opinionated defaults.
Index ¶
- type Middleware
- type Option
- type Server
- func (s *Server) AddContextExtender(contextExtender ...func(context.Context) context.Context)
- func (s *Server) AddMiddleware(middleware ...Middleware)
- func (s *Server) GracefulStop() error
- func (s *Server) Serve(lis net.Listener) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
Middleware for the HTTP Server.
func MiddlewareFunc ¶
func MiddlewareFunc(middlewareFunc func(next http.HandlerFunc) http.HandlerFunc) Middleware
MiddlewareFunc returns middlewareFunc as Middleware.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an option for the HTTP server.
func WithContextExtender ¶
WithContextExtender adds functions that extend request contexts.
func WithMiddleware ¶
func WithMiddleware(middleware ...Middleware) Option
WithMiddleware adds middleware.
func WithRouter ¶
WithRouter returns an option that sets the Router of the server.
func WithServeMux ¶
WithServeMux returns an option that sets the ServeMux of the server.
type Server ¶
type Server struct { ServeMux *http.ServeMux Router *mux.Router // contains filtered or unexported fields }
Server wraps the HTTP server.
func (*Server) AddContextExtender ¶
AddContextExtender adds functions that extend request contexts.
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(middleware ...Middleware)
AddMiddleware adds middleware.
func (*Server) GracefulStop ¶
GracefulStop stops the HTTP server gracefully.
Click to show internal directories.
Click to hide internal directories.