macro_rules! group {
($prefix:expr, { $( $route:expr ),* $(,)? }) => { ... };
}Expand description
Define a route group with a shared prefix
Routes within a group will have the prefix prepended to their paths.
Middleware can be applied to the entire group using .middleware().
§Example
ⓘ
use kit::{routes, get, post, group};
routes! {
get("/", controllers::home::index),
// All routes in this group start with /api
group!("/api", {
get("/users", controllers::user::index), // -> GET /api/users
post("/users", controllers::user::store), // -> POST /api/users
}).middleware(AuthMiddleware),
}