Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultWriteTimeout = time.Second DefaultReadTimeout = time.Second DefaultReadHeaderTimeout = time.Second DefaultIdleTimeout = time.Second )
View Source
const SvcTypeHttpd boot.SvcType = "httpd"
Variables ¶
This section is empty.
Functions ¶
func HandleAPI ¶
func HandleAPI(pattern string, handler APIHandler)
func HandleFunc ¶
func HandleFunc(pattern string, handler http.HandlerFunc)
Types ¶
type APIHandler ¶
type APIHandler func(http.ResponseWriter, *http.Request) []byte
func (APIHandler) Handle ¶
func (ah APIHandler) Handle(w http.ResponseWriter, r *http.Request) []byte
func (APIHandler) ServeHTTP ¶
func (ah APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Cfg ¶
type Cfg struct {
Addr string `env:"HTTPD_ADDR" validate:"required" yaml:"addr"`
WriteTimeout time.Duration `env:"HTTPD_WRITE_TIMEOUT" yaml:"writeTimeout"`
ReadTimeout time.Duration `env:"HTTPD_READ_TIMEOUT" yaml:"readTimeout"`
ReadHeaderTimeout time.Duration `env:"HTTPD_READ_HEADER_TIMEOUT" yaml:"readHeaderTimeout"`
IdleTimeout time.Duration `env:"HTTPD_IDLE_TIMEOUT" yaml:"idleTimeout"`
}
type Httpd ¶
func (*Httpd) AppendError ¶
Click to show internal directories.
Click to hide internal directories.