Documentation ¶
Index ¶
Constants ¶
View Source
const (
// HeaderNameAuthorization is the name of the HTTP Authorization header
HeaderNameAuthorization = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server interface { // AddRoute stores a route after validation AddRoute(method string, path string, hasAuth bool, handler http.Handler) error // AddOptionsRoutes adds OPTIONS handler for each route that has been added. // If age is 0, the default of 300 is used. // If origin is not specified, the default of "*" is used. AddOptionsRoutes(age int, origin string, logFunc func(http.Handler) http.Handler) // Config configures the internal `http.Server` that is used // This must be called before `Server.Start` // // This sets the following defaults: // // ReadTimeout: 10 seconds, // ReadHeaderTimeout: 2 seconds, // WriteTimeout: 10 seconds, // // This can be changed using `Server.Server` Config(addr string, port int) error // Server returns the internal `http.Server` // This can be used to change options on the `http.Server`. // // This should be called after `Server.Config` otherwise it will return nil. Server() *http.Server // Start starts the `http.Server` listening process. // // logger can be nil if logging of startup is not desired. Start(logger func(string)) error }
Server holds the http.Server, http.ServeMux and paths that are being served.
Click to show internal directories.
Click to hide internal directories.