#routing #axum

axum-distributed-routing

Distributed routing for axum

5 releases

Uses new Rust 2024

new 0.1.4 Jul 30, 2025
0.1.3 Apr 2, 2025
0.1.2 Apr 2, 2025
0.1.1 Apr 2, 2025
0.1.0 Apr 2, 2025

#31 in #routing

Download history 221/week @ 2025-04-03 1/week @ 2025-04-17 1/week @ 2025-05-15

296 downloads per month

MIT license

10KB
101 lines

Axum Distributed Routing

[!WARNING] This crate is experimental, use at your own risk!

Provides utilities for generating statically typed distributed routes for axum.

Usage

use axum_distributed_routing::*;

struct MyState(String);

route_group!(MyRoutes, MyState);

route!(
    group = MyRoutes,
    path = "/hello/{name:String}",
    method = GET,
    async hello -> String {
        format!("{} {}!", state.0, name)
    }
);

#[tokio::main]
async fn main() {
    let app = create_router!(MyRoutes);

    let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await.unwrap();

    axum::serve(listener, app).await.unwrap();
}

Dependencies

~5–14MB
~171K SLoC