Documentation
¶
Index ¶
- Constants
- type Action
- type Context
- type Group
- func (g *Group) AddMiddleware(f func(Context) error) Middleware
- func (g *Group) Get(path string) *Route
- func (g *Group) GetAction(f func(Context) error) *Route
- func (g *Group) GetSecureAction(f func(Context) error) *Route
- func (g *Group) Post(path string) *Route
- func (g *Group) PostAction(f func(Context) error) *Route
- func (g *Group) PostSecureAction(f func(Context) error) *Route
- type Middleware
- type Render
- type Request
- type RequestHeader
- type Response
- type ResponseHeader
- type Route
- type Server
- func (s *Server) AddMiddleware(f func(Context) error) Middleware
- func (s *Server) Connect() error
- func (s *Server) Database() *dbm.Connection
- func (s *Server) FileRoute(path, dest, redirectTo string) error
- func (s *Server) FileRouteRemove(path string) error
- func (s *Server) Get(path string) *Route
- func (s *Server) Group(name string) *Group
- func (s *Server) NormalizeFunc(n bool)
- func (s *Server) OpenDatabase(driver, host string, port int, username, password, name string) error
- func (s *Server) Post(path string) *Route
- func (s *Server) PostAction(f func(Context) error) *Route
- func (s *Server) PostSecureAction(f func(Context) error) *Route
- func (s *Server) Proxy(path, dest string) error
- func (s *Server) Serve(port int) error
- func (s *Server) SetLogger(debug func(...interface{}), info func(...interface{}), ...)
- func (s *Server) SetRender(r Render)
- func (s *Server) Shutdown() error
- type Session
Constants ¶
View Source
const ( //MethodGet GET MethodGet string = fasthttp.MethodGet //MethodPost POST MethodPost string = fasthttp.MethodPost //StatusBadRequest ... StatusBadRequest = fasthttp.StatusBadRequest StatusUnauthorized = fasthttp.StatusUnauthorized //StatusNotFound ... StatusForbidden = fasthttp.StatusForbidden //StatusNotFound ... StatusNotFound = fasthttp.StatusNotFound //StatusOK ... StatusOK = 200 //StatusInternalServerError ... StatusInternalServerError = fasthttp.StatusInternalServerError //StatusBadGateway ... StatusBadGateway = 502 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
URL() *url.URL
Method() string
ContentType() string
RemoteIP() string
Write(value interface{}) error
//WriteBody write to body and ignoring the next action
WriteBody(contentType string, body []byte) error
//Status stop execution and return status and message
Status(status int, msg string) error
//Error stop execution, rollback database transaction, and return status and message
Error(status int, msg string) error
//StatusBadRequest 400
StatusBadRequest(msg string) error
StatusUnauthorized(msg string) error
//StatusUnauthorized 403
StatusForbidden(msg string) error
//StatusNotFound 404
StatusNotFound(msg string) error
StatusInternalServerError(msg string) error
Redirect(url string) error
Request() Request
Response() Response
Tx() (*dbm.Tx, error)
Session() Session
SetValue(name string, value interface{})
GetValue(name string) interface{}
}
Context ..
type Group ¶ added in v0.6.0
type Group struct {
// contains filtered or unexported fields
}
Group ..
func (*Group) AddMiddleware ¶ added in v0.6.0
func (g *Group) AddMiddleware(f func(Context) error) Middleware
AddMiddleware ..
func (*Group) GetSecureAction ¶ added in v0.7.0
type Middleware ¶
type Middleware interface {
//ForGroup set name for this middleware, this middleware only used by route that requiring the same name
ForGroup(string) Middleware
Secure() Middleware
}
Middleware ..
type Request ¶
type Request interface {
Header() *RequestHeader
Method() string
URL() *url.URL
JSON() json.Object
Body() []byte
}
Request ..
type RequestHeader ¶ added in v0.5.0
type RequestHeader struct {
// contains filtered or unexported fields
}
RequestHeader ...
func (*RequestHeader) Bytes ¶ added in v0.6.0
func (r *RequestHeader) Bytes() []byte
type ResponseHeader ¶ added in v0.5.1
type ResponseHeader struct {
// contains filtered or unexported fields
}
ResponseHeader ...
func (*ResponseHeader) SetCookie ¶ added in v0.7.0
func (r *ResponseHeader) SetCookie(key, value string, expire int)
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route ...
func (*Route) AddQueryAction ¶
AddQueryAction ...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server ...
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(f func(Context) error) Middleware
AddMiddleware ..
func (*Server) FileRoute ¶ added in v0.4.0
FileRoute serve static file. Path parameter to determine url to be processed. Dest parameter will find directory of the file reside. RedirectTo parameter to redirect non existing file, this param can be used for SPA (ex. index.html).
func (*Server) FileRouteRemove ¶ added in v0.4.1
FileRouteRemove ...
func (*Server) NormalizeFunc ¶ added in v0.3.2
NormalizeFunc if yes from this and beyond all Func added will renamed to lowercase, separated with underscore. Ex: HelloWorld registered as hello_world
func (*Server) OpenDatabase ¶
OpenDatabase ..
func (*Server) PostAction ¶ added in v0.7.0
func (*Server) PostSecureAction ¶ added in v0.7.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.