Documentation ¶
Index ¶
- type APIServer
- type APIServerProps
- type Context
- func (c *Context) Decode(ptr interface{})
- func (c *Context) Error(message string)
- func (c *Context) GetParam(name string) *Param
- func (c *Context) GetQueryInt(name string, defaultValue int) int
- func (c *Context) GetQueryString(name string, defaultValue string) string
- func (c *Context) GetRequiredParam(name string) *Param
- func (c *Context) SendJSON(data interface{})
- func (c *Context) SendOK()
- func (c *Context) Unauthorized()
- type ErrorResponse
- type Param
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct {
// contains filtered or unexported fields
}
APIServer APIServer
func (*APIServer) Start ¶
func (s *APIServer) Start(routeMapping map[string]RouteHandler)
type APIServerProps ¶
type APIServerProps struct {
Port string
}
type Context ¶
type Context struct { Res http.ResponseWriter Req *http.Request Safe func() Params map[string]string }
func (*Context) GetQueryString ¶
func (*Context) GetRequiredParam ¶
func (*Context) Unauthorized ¶
func (c *Context) Unauthorized()
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type RouteHandler ¶
type RouteHandler func(context *Context)
Click to show internal directories.
Click to hide internal directories.