
FromRequest
Learn how the FromRequest trait works in Axum, how to implement custom extractors, and how handler arguments get their values from incoming requests.
Implementing Custom Extractors with FromRequestParts
Learn how to build your own Axum extractors that only need request metadata like headers and extensions using the FromRequestParts trait, with step-by-step examples and best practices.
Extractor Order Rules
Learn how the order of extractor parameters in an Axum handler controls execution order, why body-consuming extractors must always be last, and how to structure handler signatures correctly.
Body-Consuming Extractors Must Be Last in Axum Handlers
Understand why extractors that read the request body must appear as the last parameter in an Axum handler, how the compiler enforces this rule, and how to structure handlers that combine body and non-body extractors correctly.
Optional Extractors in Axum
Learn how to make handler arguments optional using `Option<T>` for extractors that support missing values, with examples for TypedHeader, optional Query fields, and Result handling, plus common mistakes and alternatives.
Rejection Types in Axum Extractors
Understand what rejection types are, how Axum turns extraction failures into HTTP responses, and how to handle them in your handlers.
Custom Extractors Preview
Learn why custom extractors exist in Axum, how to create your own extractor types, and when implementing FromRequestParts or FromRequest is the right choice for your application.
Path Extractor in Axum
Learn how to extract dynamic parameters from URL paths in Axum using the Path extractor, including type conversion, error handling, and practical examples.
Path single parameter
How to extract one dynamic path segment as a String in Axum handlers, with practical examples and common mistakes.
Path Tuple Parameters
Extract multiple path parameters from a single URL into a Rust tuple inside Axum handlers with clear examples and common mistakes
Path Struct Parameters in Axum
Learn how to extract multiple path parameters into a custom struct using Axum's Path extractor with serde deserialization, including field renaming and typed conversions.
Typed Path Parameters with u32 in Axum
Learn how to use Path u32 to extract and automatically parse typed path parameters from the URL in Axum handlers, including error handling, common mistakes, and practical examples.
Path Deserialization Errors
Learn what happens when a URL path segment cannot be converted into the expected type and how to handle these errors gracefully in Axum handlers.
RawPathParams
Learn how to extract raw path parameters as strings without deserialization using Axum's RawPathParams extractor and the built-in Path with HashMap.
Query Extractor
Learn how to extract query string parameters from request URLs in Axum using the Query extractor, with typed structs, optional fields, and error handling.
Enabling the Query Feature Flag in Axum
Learn what Cargo feature flags do, how the query feature controls Axum's Query extractor, and how to configure it correctly in your project.
Serde Query Structs in Axum
Learn how to deserialize query parameters into typed Rust structs using serde and the Query extractor in Axum
Optional Query Fields in Axum
Learn how to make individual query parameters optional in Axum handlers using Option fields inside serde query structs, with complete examples and explanations for absolute beginners.
Query Pagination Page Field
Learn how to extract and handle the page query parameter in Axum handlers for pagination.
Query Pagination Limit Field
How to extract and handle the limit query parameter in Axum handlers for pagination, with examples and common mistakes
RawQuery
Understand the RawQuery extractor in Axum and learn how to access the original, unparsed query string from a request URL.
Building a list_users Handler with Query Pagination
Learn how to create a list_users handler in Axum that uses the Query extractor for pagination, optional filters, and returning JSON user lists with default values and error handling.
JSON Extractor in Axum
Learn how to extract and deserialize JSON request bodies using the Json extractor in Axum, from basic typed structs to flexible Value parsing and error handling.
serde Deserialize for JSON Requests
Learn how serde's Deserialize trait powers JSON request parsing in Axum handlers, with derived structs, attributes, and common pitfalls for absolute beginners.
Serialize Deserialize derive pair
Learn how to use serde's Serialize and Deserialize derive macros together on a Rust struct to handle JSON requests and responses in Axum.
Json default body limit
Understanding Axum's built-in request body size limit for the Json extractor, what the default value is, why it exists, and what happens when a JSON payload is too large
DefaultBodyLimit Layer
Learn how to set a default request body size limit for all body-consuming extractors in Axum using the DefaultBodyLimit layer.
Json deserialization rejection
Understand how Axum rejects invalid JSON request bodies and how to customize the error response using JsonRejection.
create_user handler
Learn how to write an Axum handler that receives a JSON request body and creates a user, including response types, data structures, and common patterns.
POST create_user Route
How to register a POST route in Axum that accepts JSON request bodies for user creation and returns appropriate responses.
Form Extractor in Axum
Learn how to parse HTML form data sent as URL-encoded strings in Axum handlers using the Form extractor.
Enabling the Form Feature Flag in Axum
Learn how to enable Axum's optional form feature flag so you can extract HTML form data with the Form extractor, including common setup mistakes and troubleshooting.
application/x-www-form-urlencoded
Understand how Axum's Form extractor works with the application/x-www-form-urlencoded content type, the default encoding for HTML forms, and how to use it in your handlers.
RawForm
Learn how to extract raw form data as bytes with the RawForm extractor in Axum
HeaderMap Extractor
Learn how to extract and work with HTTP request headers in Axum handlers using the HeaderMap extractor.
HeaderName - Working with HTTP Header Names in Axum
Learn how to use the HeaderName type in Axum to read and manage request header names, including static and dynamic creation, predefined constants, and common pitfalls
HeaderValue in Axum Extractors
Learn how to work with header values in Axum handlers, from basic retrieval to building custom extractors that return HeaderValue directly.
TypedHeader - Typed HTTP Header Extraction in Axum
Learn how to use the TypedHeader extractor from axum-extra to safely parse HTTP headers into strongly typed Rust values, including setup, usage patterns, handling missing or invalid headers, and common beginner mistakes.
Adding the axum-extra Dependency
Learn what the axum-extra crate is, why typed header support lives there, and how to add it to your Rust project with the typed-header feature flag.
Authorization Header in Axum
Learn how to extract and work with the Authorization header in Axum handlers, covering raw header access, typed bearer tokens, basic authentication, and custom extractors.
User-Agent header
How to extract the User-Agent header from HTTP requests in Axum, using HeaderMap, TypedHeader, optional extraction, and custom extractors
Extension Extractor in Axum
Learn how to retrieve application state with the Extension extractor in Axum handlers, including setup, type requirements, and real-world usage patterns.
Extension Layer in Axum
How to provide shared data to handlers using the Extension layer in Axum, including setup, routing scopes, multiple extensions, and common mistakes.
Extension Request-Scoped Data
Learn how to pass per-request data through Axum handlers using the Extension extractor with practical examples and clear beginner explanations
Missing Extension Runtime Error
Understand why Axum returns a runtime error when an Extension is missing and how to fix it with the Extension layer, Option, or Result.
Extractor argument order
Learn how the order of extractor arguments in Axum handlers works and why only the last argument can consume the request body
update_user example signature
Learn how to write the handler signature for an update_user endpoint in Axum with correct extractor ordering, including multiple examples and common mistakes.
PUT update_user route
Learn how to define a PUT route for updating a user in Axum, combine multiple extractors in the correct order, and handle request bodies safely.
Custom FromRequestParts Implementation in Axum
Learn how to build a custom Axum extractor that reads request metadata without touching the body, using FromRequestParts with many beginner-friendly examples.
Custom FromRequest implementation in Axum
Learn how to create your own body-consuming extractors by implementing the FromRequest trait in Axum, with many beginner-friendly examples.
FromRequest and FromRequestParts on the Same Type
Understand why implementing both extractor traits on one type makes it ambiguous as a handler argument, and how to design custom extractors without running into that ambiguity.
AuthUser sketch
A planning guide for designing a custom AuthUser extractor in Axum covering data shapes, trait selection, rejection types, and handler integration
Authorization Parsing
How to parse and validate the Authorization header inside custom Axum extractors.
Bytes Body Extractor in Axum - Reading Raw Request Body
Learn how to use the Bytes extractor in Axum to read the raw request body as binary data without JSON or text parsing.
String Body Extractor
Learn how to read raw UTF-8 request bodies as Strings in Axum handlers, including limits, errors, and complete working examples.
Request Extractor
Learn how to extract the complete HTTP request object in Axum handlers, including method, headers, URI, and body, and understand when to use this powerful extractor.
Uri Extractor
Learn how to use Axum's Uri extractor to access the raw request URI in handlers, inspect its components, and avoid common beginner mistakes.
MatchedPath extractor
Learn how to get the route template that matched a request in Axum - what MatchedPath is, why it exists, and how to use it for logging and metrics
OriginalUri Extractor
Learn how to access the original request URI before Axum nest rewriting changes the path in nested routers
Optional Extractors with Option<T> in Axum
Learn how to handle optional request data in Axum handlers using `Option<T>` with extractors, including the difference between missing and invalid data.
Handling Extractor Rejections with Result in Handlers
Learn how to catch and handle extractor failures manually by wrapping Axum extractors in Result types inside handler functions
Custom Path Types with FromStr in Axum
Learn how to use custom types that implement FromStr as path parameters in Axum routes, with examples and error handling.
Content-Type Header Reading in Axum
Learn how to read and validate the Content-Type header in Axum handlers using HeaderMap, TypedHeader, and custom extractors, with practical examples for absolute beginners.
WithRejection wrapper
Learn how to use the WithRejection wrapper from axum-extra to customize the error responses returned when an extractor rejects a request.
Path tuple length mismatches
Learn what happens in Axum 0.8 when the number of path parameters in a route does not match the tuple length of a Path extractor, and how the runtime errors differ for tuples, single values, and structs.