Method SetRoute
SetRoute(RouteMethod, string, RouteAction)
Defines an route with their method, path and action function.
public void SetRoute(RouteMethod method, string path, RouteAction action)
Parameters
method
RouteMethodThe route method to be matched. "Any" means any method that matches their path.
path
stringThe route path.
action
RouteActionThe route function to be called after matched.
SetRoute(RouteMethod, string, RouteAction, string?)
Defines an route with their method, path, action function and name.
public void SetRoute(RouteMethod method, string path, RouteAction action, string? name)
Parameters
method
RouteMethodThe route method to be matched. "Any" means any method that matches their path.
path
stringThe route path.
action
RouteActionThe route function to be called after matched.
name
stringThe route name.
SetRoute(RouteMethod, string, RouteAction, string?, IRequestHandler[])
Defines an route with their method, path, action function, name and request handlers.
public void SetRoute(RouteMethod method, string path, RouteAction action, string? name, IRequestHandler[] middlewares)
Parameters
method
RouteMethodThe route method to be matched. "Any" means any method that matches their path.
path
stringThe route path.
action
RouteActionThe route function to be called after matched.
name
stringThe route name.
middlewares
IRequestHandler[]Handlers that run before calling your route action.
SetRoute(Route)
Defines an route in this Router instance.
public void SetRoute(Route r)
Parameters
r
RouteThe route to be defined in the Router.