4 releases
Uses new Rust 2024
0.1.3 | Apr 2, 2025 |
---|---|
0.1.2 | Apr 2, 2025 |
0.1.1 | Apr 2, 2025 |
0.1.0 | Apr 2, 2025 |
#7 in #risk
378 downloads per month
9KB
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
~6–12MB
~138K SLoC