-
SummaryWhat is recommended way for creating a server for web backend application? // build our application with some routes
let app = Router::new()
.route("/", get(using_connection_pool_extractor).post(using_connection_extractor))
.with_state(pool);
// run it with hyper
let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap();
tracing::debug!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap(); Or let listener = TcpListener::bind("127.0.0.1:3000").await.unwrap();
let addr = listener.local_addr().unwrap();
tracing::info!("🚀 Server running at http://{}", addr);
axum::Server::from_tcp(listener)
.unwrap()
.serve(app.into_make_service())
.await
.unwrap(); Which is recommended way? axum version0.8.1 |
Beta Was this translation helpful? Give feedback.
Answered by
jplatte
Mar 6, 2025
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alokmahor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
axum::Server
does not exist anymore as of axum 0.7.0.