Skip to content
Snippets Groups Projects
Unverified Commit 5ab21e2a authored by Martin Kröning's avatar Martin Kröning :crab: Committed by GitHub
Browse files

Merge pull request #616 from hermit-os/axum

feat: add axum example
parents 05f13124 94622695
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ members = [
"benches/alloc",
"benches/micro",
"benches/netbench",
"examples/axum",
"examples/demo",
"examples/fuse_test",
"examples/hello_world",
......
[package]
name = "axum-example"
edition = "2021"
[dependencies]
axum = "0.7"
tokio = "1"
[target.'cfg(target_os = "hermit")'.dependencies]
hermit = { path = "../../hermit" }
use axum::routing::get;
use axum::Router;
#[cfg(target_os = "hermit")]
use hermit as _;
use tokio::{io, net};
#[tokio::main(flavor = "current_thread")]
async fn main() -> io::Result<()> {
let app = Router::new().route("/", get(root));
let listener = net::TcpListener::bind("0.0.0.0:9975").await?;
axum::serve(listener, app).await?;
Ok(())
}
async fn root() -> &'static str {
"Hello, World!"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment