--- /dev/null
+[package]
+name = "axum-server"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+axum = "0.5"
+tokio = { version = "1", features = ["full"] }
+tower = "0.4"
+tower-http = { version = "0.3", features = ["trace"] }
+tracing = "0.1"
+tracing-subscriber = "0.3"
--- /dev/null
+use axum::{
+ routing::{get},
+ extract::Path,
+ http,
+ response,
+ Router};
+
+async fn hello(Path(name): Path<String>) -> impl response::IntoResponse {
+ (http::StatusCode::OK, format!("Hello {}", name))
+}
+
+#[tokio::main]
+async fn main() {
+ tracing_subscriber::fmt::init();
+ let app = Router::new()
+ .route("/hello/:name", get(hello))
+ .layer(
+ tower::ServiceBuilder::new()
+ .layer(tower_http::trace::TraceLayer::new_for_http())
+ );
+
+ let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 3000));
+ tracing::info!("listening on {}", addr);
+ axum::Server::bind(&addr)
+ .serve(app.into_make_service())
+ .await
+ .unwrap();
+}