add axum && example server

This commit is contained in:
Vri 🌈 2023-10-11 20:23:13 +02:00
parent 075874884e
commit 3bf2af3d9c
Signed by: vrifox
SSH key fingerprint: SHA256:7OLOvW+jmULkXpdl5rUWgid7WJQhOIEgj+4WP/PtCpI
3 changed files with 760 additions and 2 deletions

View file

@ -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();
}