Documentation
¶
Index ¶
- Constants
- type Action
- type Context
- type Middleware
- type Request
- type RequestHeader
- type Response
- type Route
- type RouteAuthenticator
- type Server
- func (s *Server) AddFinalHandler(f func(ctx Context))
- func (s *Server) AddFuncRoute(f func(ctx Context) (interface{}, error), secure bool) (*Route, error)
- func (s *Server) AddMiddleware(m Middleware)
- func (s *Server) AddQueryRoute(path, query, params string, secure bool) (*Route, error)
- func (s *Server) AddRouteAuthenticator(a RouteAuthenticator)
- func (s *Server) Connect() error
- func (s *Server) Database() *db.Connection
- func (s *Server) FileRoute(path, dest, redirectTo string) error
- func (s *Server) FileRouteRemove(path string) error
- func (s *Server) GetRoute(method, path string) (*Route, error)
- func (s *Server) NormalizeFunc(n bool)
- func (s *Server) OpenDatabase(host string, port int, username, password, name string) error
- func (s *Server) Proxy(path, dest string) error
- func (s *Server) Serve(port int) error
- func (s *Server) SetDatabase(host string, port int, username, password, name string)
- func (s *Server) SetDebug()
- func (s *Server) SetLogger(debug func(v ...interface{}), warn func(v ...interface{}), ...)
- func (s *Server) SetProduction()
- func (s *Server) SetRoute(method, path string, route *Route)
- type Session
Constants ¶
const ( //MethodGet GET MethodGet string = `GET` //MethodPost POST MethodPost string = `POST` //StatusBadRequest ... StatusBadRequest = 400 StatusUnauthorized = 401 //StatusNotFound ... StatusNotFound = 404 //StatusOK ... StatusOK = 200 //StatusInternalServerError ... StatusInternalServerError = 500 //StatusBadGateway ... StatusBadGateway = 502 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request interface {
Method() string
URL() *url.URL
JSON() json.Object
Header() *RequestHeader
}
Request ..
type RequestHeader ¶ added in v0.5.0
type RequestHeader struct {
// contains filtered or unexported fields
}
RequestHeader ...
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route ...
func NewFuncRoute ¶ added in v0.4.0
NewFuncRoute create POST route with single func action
func (*Route) AddFuncAction ¶
func (r *Route) AddFuncAction(f func(ctx Context) (interface{}, error), property string) (Action, error)
AddFuncAction ...
func (*Route) AddQueryAction ¶
AddQueryAction ...
type RouteAuthenticator ¶ added in v0.5.0
RouteAuthenticator ..
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server ...
func (*Server) AddFinalHandler ¶ added in v0.5.0
AddFinalHandler ..
func (*Server) AddFuncRoute ¶ added in v0.3.2
func (s *Server) AddFuncRoute(f func(ctx Context) (interface{}, error), secure bool) (*Route, error)
AddFuncRoute add route with single func action. When secure is true, this route will validated using auth middlewares if any.
func (*Server) AddQueryRoute ¶ added in v0.3.2
AddQueryRoute add route with single query action. When secure is true, this route will validated using auth middlewares if any.
func (*Server) AddRouteAuthenticator ¶ added in v0.5.0
func (s *Server) AddRouteAuthenticator(a RouteAuthenticator)
AddRouteAuthenticator ..
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 call SetDatabase and Connect
func (*Server) SetDatabase ¶
SetDatabase ...