mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Tweak hello world example
This commit is contained in:
+3
-5
@@ -32,17 +32,15 @@
|
||||
//! #[tokio::main]
|
||||
//! async fn main() {
|
||||
//! // build our application with a single route
|
||||
//! let app = route("/", get(handler));
|
||||
//! let app = route("/", get(|request: Request<Body>| async {
|
||||
//! "Hello, World!"
|
||||
//! }));
|
||||
//!
|
||||
//! // run it with hyper on localhost:3000
|
||||
//! let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||
//! let server = Server::bind(&addr).serve(Shared::new(app));
|
||||
//! server.await.unwrap();
|
||||
//! }
|
||||
//!
|
||||
//! async fn handler(req: Request<Body>) -> &'static str {
|
||||
//! "Hello, World!"
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! # Routing
|
||||
|
||||
Reference in New Issue
Block a user