Fix localhost vs 0.0.0.0 discrepancy (#1984)

This commit is contained in:
Matt Fellenz 2023-05-03 14:17:18 -07:00 committed by GitHub
parent b663072504
commit b0eb7a24bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -53,7 +53,7 @@ async fn main() {
// `POST /users` goes to `create_user` // `POST /users` goes to `create_user`
.route("/users", post(create_user)); .route("/users", post(create_user));
// run our app with hyper // run our app with hyper, listening globally on port 3000
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap(); axum::serve(listener, app).await.unwrap();
} }

View file

@ -53,7 +53,7 @@
//! // build our application with a single route //! // build our application with a single route
//! let app = Router::new().route("/", get(|| async { "Hello, World!" })); //! let app = Router::new().route("/", get(|| async { "Hello, World!" }));
//! //!
//! // run it on localhost:3000 //! // run our app with hyper, listening globally on port 3000
//! let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); //! let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
//! axum::serve(listener, app).await.unwrap(); //! axum::serve(listener, app).await.unwrap();
//! } //! }