Documentation
¶
Overview ¶
Package server provides an HTTP server with sane defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a wrapper around an http.Server that attempts to shutdown gracefully. Unlike http.Server, this implementation does not return an error if the server is shutdown cleanly.
func New ¶
New returns a Server that listens on the given port on any interface (0.0.0.0:PORT). Read, write, and idle timeouts are set to sane values.
func (Server) ListenAndServe ¶
ListenAndServe listens for connections on interface 0.0.0.0 at the port provided to New. If the provided context is canceled, the server will attempt to gracefully shutdown. The returned error will only be non-nil if the server exits abnormally or fails to shutdown in time.