func RouterFilter(c *Controller, fc []Filter)
type ActionDefinition struct { Host, Method, Url, Action string Star bool Args map[string]string }
func (a *ActionDefinition) String() string
type Route struct { Method string // e.g. GET Path string // e.g. /app/:id Action string // e.g. "Application.ShowApp", "404" ControllerName string // e.g. "Application", "" MethodName string // e.g. "ShowApp", "" FixedParams []string // e.g. "arg1","arg2","arg3" (CSV formatting) TreePath string // e.g. "/GET/app/:id" // contains filtered or unexported fields }
func NewRoute(method, path, action, fixedArgs, routesPath string, line int) (r *Route)
Prepares the route to be used in matching.
type RouteMatch struct { Action string // e.g. 404 ControllerName string // e.g. Application MethodName string // e.g. ShowApp FixedParams []string Params map[string][]string // e.g. {id: 123} }
type Router struct { Routes []*Route Tree *pathtree.Node // contains filtered or unexported fields }
func NewRouter(routesPath string) *Router
func (router *Router) Refresh() (err *Error)
Refresh re-reads the routes file and re-calculates the routing table. Returns an error if a specified action could not be found.
func (router *Router) Reverse(action string, argValues map[string]string) *ActionDefinition
func (router *Router) Route(req *http.Request) *RouteMatch