Expand description
Router for passing requests to their respective views.
§Examples
use cot::request::Request;
use cot::response::Response;
use cot::router::{Route, Router};
async fn home(request: Request) -> cot::Result<Response> {
Ok(cot::reverse_redirect!(request, "get_page", page = 123)?)
}
async fn get_page(request: Request) -> cot::Result<Response> {
unimplemented!()
}
let router = Router::with_urls([Route::with_handler_and_name(
"/{page}", get_page, "get_page",
)]);Modules§
Structs§
- Route
- A route that can be used to route requests to their respective views.
- Router
- A router that can be used to route requests to their respective views.
- Router
Service - A service that routes requests to their respective views.
- Urls
- A helper structure to allow reversing URLs from a request handler.