Documentation ¶
Overview ¶
Package ws provides a simple RESTful web server.
Index ¶
- func IsOK(err error) bool
- type Context
- func (a *Context) Content(name string, modtime time.Time, content io.ReadSeeker) error
- func (a *Context) DecodeJSON(value interface{}) error
- func (a *Context) DecodeXML(value interface{}) error
- func (a *Context) File(path string) error
- func (a *Context) Form(key string) string
- func (a *Context) FormAll(key string) []string
- func (a *Context) FormBool(key string) (bool, error)
- func (a *Context) FormFile(key string) (multipart.File, *multipart.FileHeader, error)
- func (a *Context) FormFloat(key string) (float64, error)
- func (a *Context) FormInt(key string) (int64, error)
- func (a *Context) Get(key string) interface{}
- func (a *Context) JSON(value interface{}) error
- func (a *Context) Next() error
- func (a *Context) Param(key string) string
- func (a *Context) ParamBool(key string) (bool, error)
- func (a *Context) ParamFloat(key string) (float64, error)
- func (a *Context) ParamInt(key string) (int64, error)
- func (a *Context) Query(key string) string
- func (a *Context) QueryAll(key string) []string
- func (a *Context) QueryBool(key string) (bool, error)
- func (a *Context) QueryFloat(key string) (float64, error)
- func (a *Context) QueryInt(key string) (int64, error)
- func (a *Context) RealIP() string
- func (a *Context) Set(key string, value interface{})
- func (a *Context) Text(value string) error
- func (a *Context) XML(value interface{}) error
- type Router
- func (a *Router) Delete(pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Get(pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Handle(method string, pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Patch(pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Post(pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Put(pattern string, hs ...func(*Context) error) *Router
- func (a *Router) Route(pattern string) *Router
- func (a *Router) Use(hs ...func(*Context) error) *Router
- type Server
- func (a *Server) Addr(addr string) *Server
- func (a *Server) Config(f func(s *http.Server)) *Server
- func (a *Server) IdleTimeout(d time.Duration) *Server
- func (a *Server) MaxHeaderBytes(n int) *Server
- func (a *Server) ReadHeaderTimeout(d time.Duration) *Server
- func (a *Server) ReadTimeout(d time.Duration) *Server
- func (a *Server) Start() error
- func (a *Server) TLS(certfile, keyfile string) *Server
- func (a *Server) WriteTimeout(d time.Duration) *Server
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct { ResponseWriter http.ResponseWriter Request *http.Request Reader io.ReadCloser Path string // contains filtered or unexported fields }
Context represents the context which hold the HTTP request and response.
func (*Context) DecodeJSON ¶
DecodeJSON decodes the JSON data.
func (*Context) Form ¶ added in v0.0.4
Form returns the first value for the named component of the request body.
func (*Context) FormAll ¶ added in v0.0.4
FormAll returns the values for the named component of the request body.
func (*Context) ParamFloat ¶ added in v0.0.4
ParamFloat return the param as float by key.
func (*Context) QueryAll ¶ added in v0.0.2
QueryAll returns the values associated with the given key.
func (*Context) QueryFloat ¶ added in v0.0.4
QueryFloat return the param as float by key.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router represents a router node.
type Server ¶
type Server struct { Router // contains filtered or unexported fields }
Server represents a web server.
func (*Server) Addr ¶ added in v0.0.3
Addr optionally specifies the TCP address for the server to listen on.
func (*Server) IdleTimeout ¶ added in v0.0.3
IdleTimeout is the maximum amount of time to wait for the next request when keep-alives are enabled.
func (*Server) MaxHeaderBytes ¶ added in v0.0.3
MaxHeaderBytes controls the maximum number of bytes the server will read parsing the request header's keys and values.
func (*Server) ReadHeaderTimeout ¶ added in v0.0.3
ReadHeaderTimeout is the amount of time allowed to read request headers.
func (*Server) ReadTimeout ¶ added in v0.0.3
ReadTimeout is the maximum duration for reading the entire request, including the body.
Directories ¶
Path | Synopsis |
---|---|
Package cors provides a simple cors middleware.
|
Package cors provides a simple cors middleware. |
Package limiter provides a simple limiter middleware.
|
Package limiter provides a simple limiter middleware. |
Package static provides a simple static file middleware.
|
Package static provides a simple static file middleware. |