Documentation ¶
Overview ¶
hapi provides a Hypermedia API (aka "true" REST) micro-framework/toolkit
Index ¶
- type Handle
- type HypermediaAPI
- func (h *HypermediaAPI) GET(path, ctype string, handle Handle)
- func (h *HypermediaAPI) GETAll(path string, handle Handle)
- func (h *HypermediaAPI) Handler(method, path, ctype string, handler http.Handler)
- func (h *HypermediaAPI) HandlerFunc(method, path, ctype string, handlerFunc http.HandlerFunc)
- func (h *HypermediaAPI) Register(method, path, ctype string, handle Handle)
- func (h *HypermediaAPI) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *HypermediaAPI) TypeAndHandler(method, path, acceptHeader string) (negotiatedType string, typeHandler Handle)
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HypermediaAPI ¶
type HypermediaAPI struct { Router *httprouter.Router // Configurable hapi.Handler which is called when the requested media // type (via Accept: header) cannot be served by a registered handler. // If it is not set, http.Error with http.StatusUnsupportedMediaType is used. UnsupportedMediaType Handle // contains filtered or unexported fields }
func New ¶
func New() *HypermediaAPI
func (*HypermediaAPI) GET ¶
func (h *HypermediaAPI) GET(path, ctype string, handle Handle)
func (*HypermediaAPI) GETAll ¶
func (h *HypermediaAPI) GETAll(path string, handle Handle)
func (*HypermediaAPI) Handler ¶
func (h *HypermediaAPI) Handler(method, path, ctype string, handler http.Handler)
Handler() is an adapter which allows the usage of an http.Handler as a request handle
func (*HypermediaAPI) HandlerFunc ¶
func (h *HypermediaAPI) HandlerFunc(method, path, ctype string, handlerFunc http.HandlerFunc)
HandlerFunc() is an adaptor which allows the usage of an http.HandlerFunc as a request handle
func (*HypermediaAPI) Register ¶
func (h *HypermediaAPI) Register(method, path, ctype string, handle Handle)
Register() registers a handler method to handle a specific Method/path/content-type combination Method and path ought to be self-explanatory. The content type argument should be a space-separated list of valid content types. Wildcards are not permitted.
func (*HypermediaAPI) ServeHTTP ¶
func (h *HypermediaAPI) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HypermediaAPI) TypeAndHandler ¶
func (h *HypermediaAPI) TypeAndHandler(method, path, acceptHeader string) (negotiatedType string, typeHandler Handle)
Click to show internal directories.
Click to hide internal directories.