Documentation ¶
Index ¶
- Constants
- func Handle(pattern string, handler http.Handler)
- func HandleAPI(pattern string, handler APIHandler)
- func HandleFunc(pattern string, handler http.HandlerFunc)
- func HandleREST(pattern string, handler RESTHandler)
- func HandleRaw(pattern string, handler RawHandler)
- func RegisterMiddleware(mf ...MiddlewareFunc)
- func RestRecoverMiddleware(next http.Handler) http.Handler
- type APIHandler
- type Cfg
- type Httpd
- type MiddlewareFunc
- type RESTHandler
- type RawHandler
- type Resp
- type RespCode
Constants ¶
View Source
const ( DefaultWriteTimeout = time.Second DefaultReadTimeout = time.Second DefaultReadHeaderTimeout = time.Second DefaultIdleTimeout = time.Second )
View Source
const DaemonTypeHttpd boot.DaemonType = "httpd"
Variables ¶
This section is empty.
Functions ¶
func HandleAPI ¶
func HandleAPI(pattern string, handler APIHandler)
func HandleFunc ¶
func HandleFunc(pattern string, handler http.HandlerFunc)
func HandleREST ¶
func HandleREST(pattern string, handler RESTHandler)
func HandleRaw ¶
func HandleRaw(pattern string, handler RawHandler)
func RegisterMiddleware ¶
func RegisterMiddleware(mf ...MiddlewareFunc)
RegisterMiddleware must called before Handle func below
Types ¶
type APIHandler ¶
type APIHandler func(http.ResponseWriter, *http.Request) interface{}
func (APIHandler) Handle ¶
func (ah APIHandler) Handle(w http.ResponseWriter, r *http.Request) interface{}
func (APIHandler) ServeHTTP ¶
func (ah APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Cfg ¶
type Cfg struct { Addr string `` /* 145-byte string literal not displayed */ WriteTimeout time.Duration `` /* 183-byte string literal not displayed */ ReadTimeout time.Duration `` /* 251-byte string literal not displayed */ ReadHeaderTimeout time.Duration `` /* 176-byte string literal not displayed */ IdleTimeout time.Duration `` /* 206-byte string literal not displayed */ }
type Httpd ¶
func (*Httpd) AppendError ¶
func (*Httpd) RegisterMiddleware ¶
func (h *Httpd) RegisterMiddleware(mf ...MiddlewareFunc)
type RESTHandler ¶
type RESTHandler func(http.ResponseWriter, *http.Request) interface{}
func (RESTHandler) Handle ¶
func (rh RESTHandler) Handle(w http.ResponseWriter, r *http.Request) interface{}
func (RESTHandler) ServeHTTP ¶
func (rh RESTHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RawHandler ¶
type RawHandler func(http.ResponseWriter, *http.Request) []byte
func (RawHandler) Handle ¶
func (rh RawHandler) Handle(w http.ResponseWriter, r *http.Request) []byte
func (RawHandler) ServeHTTP ¶
func (rh RawHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.