Extractors
Parse requests.
What is an extractor?
An extractor is a handler parameter that pulls a piece of the request out for you. Axum inspects the parameter types and fills them in.
- No manual request parsing
- Type-driven and composable
Path extractor
Path captures dynamic URL segments. The type inside determines how the segment is parsed.
use axum::extract::Path;
async fn user(Path(id): Path<u32>) -> String {
format!("user {}", id)
}All lessons in this course
- Axum Routing
- Extractors
- JSON and State
- Middleware