Skip to content

Commit

Permalink
Fix Axum benchmark (#8026)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyatt-herkamp authored Dec 8, 2024
1 parent c26d726 commit 629b809
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions rust/axum/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@ use axum::Router;

#[tokio::main]
async fn main() {
let router: Router = Router::new();

let router: Router = router.route("/", get(|| async {}));

let router: Router = router.route(
"/user/:id",
get(|Path(id): Path<u8>| async move { id.to_string() }),
);

let router: Router = router.route("/user", post(|| async {}));
let router: Router = Router::new()
.route("/", get(|| async {}))
.route("/user", post(|| async {}))
.route("/user/:id", get(|Path(id): Path<String>| async move { id }));

let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, router.into_make_service())
Expand Down

0 comments on commit 629b809

Please sign in to comment.