Documentation ¶
Overview ¶
Package handler implements the request handlers for the API.
Index ¶
- type Cache
- type Handler
- func (h *Handler) Cached(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Health(w http.ResponseWriter, r *http.Request)
- func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Protected(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Unauthorized(w http.ResponseWriter, r *http.Request)
- type SimpleResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler has all the functions needed to serve our api.
func (*Handler) Cached ¶
func (h *Handler) Cached(w http.ResponseWriter, r *http.Request)
Cached gets a value from redis and writes it to the response.
func (*Handler) Health ¶
func (h *Handler) Health(w http.ResponseWriter, r *http.Request)
Health always returns a 200 response.
func (*Handler) NotFound ¶
func (h *Handler) NotFound(w http.ResponseWriter, r *http.Request)
NotFound is called when the request is for an unknown resource.
func (*Handler) Protected ¶
func (h *Handler) Protected(w http.ResponseWriter, r *http.Request)
Protected is a protected endpoint example.
func (*Handler) Unauthorized ¶
func (h *Handler) Unauthorized(w http.ResponseWriter, r *http.Request)
Unauthorized is called when the request is not authorized.
type SimpleResponse ¶
type SimpleResponse struct { XMLName xml.Name `json:"-" xml:"simpleResponse"` TraceID string `json:"trace_id" xml:"traceId,attr"` Message string `json:"message" xml:",innerxml"` }
SimpleResponse is used to send a meaningful message back to the caller, with trace id to debug later.
Click to show internal directories.
Click to hide internal directories.