Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  
const ( ErrProcessingRequestCode = iota + 1000 ErrNotFoundCode ErrNotAllowedCode ErrRequiredParamCode ErrFailedConversionCode )
Variables ¶
This section is empty.
Functions ¶
func JsonResponse ¶
func JsonResponse(w http.ResponseWriter, data interface{}, status int)
JsonResponse encodes and writes a JSON response using the given data object.
Types ¶
type Handler ¶
type Handler func(http.ResponseWriter, *http.Request, Parameters)
Handler represents an HTTP handler method.
func NewHandler ¶
func NewHandler(handler http.HandlerFunc) Handler
NewHandler wraps the HandlerFunc and returns a Handler.
type Parameters ¶
type Parameters []Parameter
Parameters represents a list of URL parameters.
func GetParameters ¶
func GetParameters(ctx context.Context) Parameters
GetParameters returns the context values as Parameters.
func (Parameters) Get ¶
func (params Parameters) Get(key string) string
Get returns a parmeter value for the given key. If a key does not exist an empty string is returned.
type ResponseSetting ¶
type ResponseSetting func(w http.ResponseWriter)
ResponseSetting can be used to configure a repsonse writer.
func SetResponseHeader ¶
func SetResponseHeader(key, value string) ResponseSetting
SetResponseHeader is a header setting that sets the response header key-value pair.
type Route ¶
type Route struct {
	Handler          Handler
	Method           string
	Path             string
	ResponseSettings []ResponseSetting
}
    Route respresents a HTTP API route
 Click to show internal directories. 
   Click to hide internal directories.