Documentation ¶
Index ¶
- Variables
- func RespondWithError(w http.ResponseWriter, code int, msg string) error
- func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) error
- func URLParam(r *http.Request, key string) string
- type Router
- func (r *Router) Connect(pattern string, handler http.HandlerFunc)
- func (r *Router) Delete(pattern string, handler http.HandlerFunc)
- func (r *Router) Get(pattern string, handler http.HandlerFunc)
- func (r *Router) Group(pattern string) *RouterGroup
- func (r *Router) Head(pattern string, handler http.HandlerFunc)
- func (r *Router) Method(method string, pattern string, handler http.HandlerFunc)
- func (r *Router) Options(pattern string, handler http.HandlerFunc)
- func (r *Router) Patch(pattern string, handler http.HandlerFunc)
- func (r *Router) Post(pattern string, handler http.HandlerFunc)
- func (r *Router) Put(pattern string, handler http.HandlerFunc)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Trace(pattern string, handler http.HandlerFunc)
- type RouterGroup
- func (r *RouterGroup) Connect(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Delete(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Get(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Head(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Method(method string, pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Options(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Patch(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Post(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Put(pattern string, handler http.HandlerFunc)
- func (r *RouterGroup) Trace(pattern string, handler http.HandlerFunc)
- type Scope
- type WebApp
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrStatusCode0Invalid = errors.New("0 is not a valid code")
)
Functions ¶
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, msg string) error
RespondWithError return error message as JSON format. Eg: {"message": "Access denied for user 'root'"}
func RespondWithJSON ¶
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) error
RespondWithJSON sends the response "payload" as JSON format to the client with code as status code.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Group ¶
func (r *Router) Group(pattern string) *RouterGroup
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) Connect ¶
func (r *RouterGroup) Connect(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Delete ¶
func (r *RouterGroup) Delete(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Get ¶
func (r *RouterGroup) Get(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Head ¶
func (r *RouterGroup) Head(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Method ¶
func (r *RouterGroup) Method(method string, pattern string, handler http.HandlerFunc)
func (*RouterGroup) Options ¶
func (r *RouterGroup) Options(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Patch ¶
func (r *RouterGroup) Patch(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Post ¶
func (r *RouterGroup) Post(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Put ¶
func (r *RouterGroup) Put(pattern string, handler http.HandlerFunc)
func (*RouterGroup) Trace ¶
func (r *RouterGroup) Trace(pattern string, handler http.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.