add axum && example server
This commit is contained in:
parent
075874884e
commit
3bf2af3d9c
3 changed files with 760 additions and 2 deletions
14
src/main.rs
14
src/main.rs
|
@ -1,3 +1,13 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use axum::{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 it with hyper on localhost:3000
|
||||
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue