Documentation ¶ Index ¶ Constants func NewServer(addr string, port int, opts ...Option) *http.Server func RunServer(ctx context.Context, srv *http.Server) error type Option func WithMux(mux *http.ServeMux) Option func WithReadTimeout(timeout time.Duration) Option Constants ¶ View Source const DefaultReadTimeout = 5 * time.Second View Source const GracefulShutdownTimeout = 5 * time.Second Variables ¶ This section is empty. Functions ¶ func NewServer ¶ func NewServer(addr string, port int, opts ...Option) *http.Server func RunServer ¶ func RunServer(ctx context.Context, srv *http.Server) error Types ¶ type Option ¶ type Option func(*http.Server) func WithMux ¶ func WithMux(mux *http.ServeMux) Option func WithReadTimeout ¶ func WithReadTimeout(timeout time.Duration) Option Source Files ¶ View all Source files server.go Click to show internal directories. Click to hide internal directories.