Documentation ¶
Index ¶
- func BootStrap()
- type Controller
- type Group
- func (g *Group) AddController(method, relativePath string, fnct server.HandlerFunc)
- func (g *Group) AddGroup(relativePath string) *Group
- func (g *Group) AddMiddleWare(fnct server.HandlerFunc)
- func (g *Group) AddStatic(relativePath, fsPath string)
- func (g *Group) ExtendController(method, relativePath string, fnct server.HandlerFunc)
- func (g *Group) GetGroup(relativePath string) (*Group, bool)
- func (g *Group) HasController(method, relativePath string) bool
- func (g *Group) MustGetGroup(relativePath string) *Group
- func (g *Group) OverrideController(method, relativePath string, fnct server.HandlerFunc)
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller is a server function that is called through an http route.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
A Group is used to group routes with common prefix, in order to apply it specific middlewares.
var Registry *Group
Registry is the central collection of all the application controllers
func (*Group) AddController ¶
func (g *Group) AddController(method, relativePath string, fnct server.HandlerFunc)
AddController creates a controller for the given method and path and sets fnct as the base handler function for this controller. It panics if such a controller already exists.
func (*Group) AddGroup ¶
AddGroup adds a sub-group to this group with the given relativePath and returns the newly created group. It panics if the group already exists.
func (*Group) AddMiddleWare ¶
func (g *Group) AddMiddleWare(fnct server.HandlerFunc)
AddMiddleWare adds the given fnct as a new middleware for this group fnct will be executed before any other middleware of this group.
Call the Next() method of fnct's context to call the next middleware. If Next is not called explicitly, the next middleware is called automatically at the end of fnct.
func (*Group) AddStatic ¶
AddStatic creates a new route at relativePath that will serve the static files found at fsPath on the file system.
func (*Group) ExtendController ¶
func (g *Group) ExtendController(method, relativePath string, fnct server.HandlerFunc)
ExtendController extends the controller for the given method and path with the given fnct handler function.
The handler fnct should call its context Super() method to call the original controller implementation. Note that if Super() is not called explicitly, the original implementation is automatically called at the end of the handler fnct. If this is not the wanted behaviour, use OverrideController instead.
ExtendController panics if such a controller does not exist
func (*Group) GetGroup ¶
GetGroup returns the sub group of this group for the given relativePath the returned boolean is 'false' if the sub group does not exists for this group
func (*Group) HasController ¶
HasController returns true if the given method and path already has a controller function
func (*Group) MustGetGroup ¶
MustGetGroup returns the sub group of this group for the given relativePath It panics if this group does not exist
func (*Group) OverrideController ¶
func (g *Group) OverrideController(method, relativePath string, fnct server.HandlerFunc)
OverrideController overrides the controller for the given method and path with the given fnct handler function.
Call to the handler fnct context Super() method has no effect, since all previous implementations are discarded. If this is not the wanted behaviour, use ExtendController instead.
OverrideController panics if such a controller does not exist