mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-17 00:00:16 +02:00
Add serve function and remove Server re-export (#1868)
This commit is contained in:
@@ -10,10 +10,11 @@ use std::{fmt, str::FromStr};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||
.serve(app().into_make_service())
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
|
||||
.await
|
||||
.unwrap();
|
||||
println!("listening on {}", listener.local_addr().unwrap());
|
||||
axum::serve(listener, app()).await.unwrap();
|
||||
}
|
||||
|
||||
fn app() -> Router {
|
||||
|
||||
Reference in New Issue
Block a user