Struct arc_reactor::routing::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]

Create a new routegroup with the specified parent.

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

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.

This example is not tested
 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);

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.

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.

Add a route and a ServiceHandler for a GET request.

Add a route and a Service for a POST request.

mount a Service as well as a MiddleWare for a POST request

mount a Service as well as a MiddleWare and MiddleWare for a POST request

mount a Service as well as a MiddleWare for a POST request

add a route and a ServiceHandler for a put request

Add a route and a ServiceHandler for a PATCH request.

Add a route and a ServiceHandler for DELETE request.

Auto Trait Implementations

impl Send for RouteGroup

impl Sync for RouteGroup