Skip to main content

Module router

Module router 

Source
Expand description

The router: what an application’s routes/web.rs fills in.

pub fn routes(r: &mut Router) {
    r.get("/", home);
    r.get("/users/{id}", show).name("users.show");

    r.group("/admin", |r| {
        r.middleware(auth);
        r.get("/dashboard", dashboard);
    });
}

Structs§

Resource
The seven RESTful routes, registered one at a time.
Route
RouteHandle
Returned by get/post/… so a route can be named after registration.
Router
Collects routes, then answers requests.