update
This commit is contained in:
parent
911ea21c75
commit
94f9cb06ec
@ -4,3 +4,6 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
axum = "0.7.5"
|
||||||
|
serde = "1.0.204"
|
||||||
|
tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] }
|
||||||
|
21
src/main.rs
21
src/main.rs
@ -1,3 +1,18 @@
|
|||||||
fn main() {
|
use axum::{
|
||||||
println!("Hello, world!");
|
routing::get,
|
||||||
}
|
Router,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
// build our application with a single route
|
||||||
|
let app = Router::new().route("/", get(|| async { "Hello, World!" }));
|
||||||
|
|
||||||
|
// run our app with hyper, listening globally on port 3000
|
||||||
|
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
|
||||||
|
|
||||||
|
println!("The rust Server is running on http://127.0.0.1:3000");
|
||||||
|
|
||||||
|
axum::serve(listener, app).await.unwrap();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user