Struct arc_reactor::RouteGroup [] [src]

pub struct RouteGroup { /* fields omitted */ }

The routegroup allows for conviniently nesting route handlers and applying group middlewares for protected routes

Methods

impl RouteGroup
[src]

[src]

create a new routegroup with the specified parent

  let routegroup = RouteGroup::new("api");
  routegroup.get("/users", UserService); // this will match "/api/users"

[src]

Mount a routegroup on this routegroup. It will apply the middlewares already mounted on the Parent RouteGroup to all the routes on the child RouteGroup

 let routegroup = RouteGroup::new("api");
 routegroup.get("/users", UserService); // this will match "/api/users"

let nestedgroup = RouteGroup::new("admin");
 // by nesting it on `routegroup`, this will match "/api/admin/delete/user"
 let nestedgroup.get("/delete/user", DeleteService);

 routegroup.group(nestedgroup);

[src]

mount a request middleware on this routegroup

ensure that the request middleware is added before any routes on the route group. the middleware only applies to the routes that are added after it has been mounted.

[src]

mount a response middleware on this routegroup

ensure that the response middleware is added before any routes on the route group. the middleware only applies to the routes that are added after it has been mounted.

[src]

add a route and a ServiceHandler for a get request

[src]

add a route and a ServiceHandler for a post request

[src]

add a route and a ServiceHandler for a put request

[src]

add a route and a ServiceHandler for a patch request

[src]

add a route and a ServiceHandler for a delete request

Trait Implementations

Auto Trait Implementations

impl Send for RouteGroup

impl Sync for RouteGroup