Documentation
¶
Index ¶
Constants ¶
View Source
const LogHandlerKey string = "Log"
View Source
const RequestIDHandlerKey string = "RequestID"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { http.Server Middleware map[string]alice.Constructor MiddlewareOrder []string Alice *alice.Chain CertFile string KeyFile string DefaultShutdownTimeout time.Duration HandleOSSignals bool }
Server is a http.Server with sensible defaults, which supports configurable middleware and timeouts, and shuts down cleanly on SIGINT/SIGTERM
func (*Server) Close ¶
Close is simply a wrapper around Shutdown that enables Server to be treated as a Closable
func (*Server) ListenAndServe ¶
ListenAndServe sets up SIGINT/SIGTERM signals, builds the middleware chain, and creates/starts a http.Server instance
If CertFile/KeyFile are both set, the http.Server instance is started using ListenAndServeTLS. Otherwise ListenAndServe is used.
Specifying one of CertFile/KeyFile without the other will panic.
func (*Server) ListenAndServeTLS ¶
ListenAndServeTLS sets KeyFile and CertFile, then calls ListenAndServe
Click to show internal directories.
Click to hide internal directories.