Courses

Learn Axum

13 lessons · 0 completed

Start
0%
  1. 1 Welcome to Axum & Ecosystem Setup The "Why": Axum vs. Actix vs. RocketThe Foundation: Understanding Tokio and Hyper ConceptuallyProject Setup: Cargo, Dependencies, and "Hello, Axum!"The Server: Binding TCP Listeners and Serving the App
  2. 2 Routing: Directing Traffic Basic Routes: HTTP Methods (GET, POST, PUT, DELETE)Path Parameters: Capturing Variables from the URLQuery Parameters: Handling Search StringsNesting Routes: Organizing APIs with Router Nesting
  3. 3 Extractors: Reading Client Input The Magic of Extractors: How Axum Parses RequestsParsing JSON Payloads: Accepting Structured DataForm Data: Handling Traditional HTML Form SubmissionsReading Headers: Extracting Authorization and Custom Headers
  4. 4 Responses: Replying to the Client The IntoResponse Trait: Understanding Axum OutputSending JSON: Serializing Rust Structs to the ClientStatus Codes: Controlling HTTP Response CodesCustom Headers: Setting Response Headers Explicitly
  5. 5 State Management: Sharing Data Safely The State Extractor: Passing Data into HandlersApplication State Structs: Grouping Dependencies (DB, Configs)Thread Safety: Using Arc and Mutex for Concurrent AccessSub-states: Creating Specific States for Nested Routers
  6. 6 Middleware: The Tower Ecosystem Enter Tower: Understanding the Service AbstractionBuilt-in Middleware: CORS, Timeout, and Payload LimitsTracing & Logging: Setting up tower-http for Request LogsWriting Custom Middleware: Intercepting Requests and Responses
  7. 7 Elegant Error Handling The Problem: Dealing with Result in Route HandlersCustom App Errors: Creating a Unified Error EnumImplementing IntoResponse for Custom ErrorsCentralized Error Responses: Returning Consistent JSON Error Formats
  8. 8 Database Integration (Practical Data) Choosing an Async DB Driver: Introduction to SQLxConnection Pools: Setting Up and Injecting the Pool via StateCRUD Operations: Executing Queries Inside Axum HandlersMigrations: Managing Database Schema Changes
  9. 9 Authentication & Security Securing Routes: The Concept of Auth MiddlewareJWT (JSON Web Tokens): Generating and Validating TokensThe Extract-Auth Pattern: Creating a Custom RequireAuth ExtractorPassword Hashing: Integrating Argon2 in User Flows
  10. 10 Files & Static Assets Serving Static Directories: Setting up ServeDirMultipart Forms: Accepting File UploadsSaving Files: Streaming Uploads to the Local Filesystem SafelyReturning Files: Sending Files as Download Responses
  11. 11 Real-time Communication with WebSockets WebSocket Basics: The Connection Upgrade ProcessThe WebSocketUpgrade Extractor: Handling WS RequestsSending and Receiving: Handling Message StreamsBroadcasting: Sharing Messages Across Connected Clients
  12. 12 Testing Your Axum Application The Testing Philosophy: Unit vs Integration Tests in AxumRouter Testing: Using axum::test_helpers and ServiceExtMocking Dependencies: Simulating Database Calls in StateEnd-to-End Tests: Spinning Up a Test Server Programmatically
  13. 13 Production Readiness & Deployment Graceful Shutdown: Handling SIGTERM SafelyConfiguration Management: Environment Variables and .env FilesDockerizing Axum: Crafting a Lean Dockerfile for RustCI/CD Basics: Automating Tests and Builds for Deployment