Add axum example
This commit is contained in:
parent
151aa09abe
commit
18e6ebf64a
|
@ -19,3 +19,6 @@ jive = { git = "https://git.asonix.dog/safe-async/jive", features = [
|
|||
"tokio-io-compat",
|
||||
] }
|
||||
tokio = { version = "1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
axum = "0.4.8"
|
||||
|
|
13
examples/axum.rs
Normal file
13
examples/axum.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
async fn hello() -> &'static str {
|
||||
"hewwo mr obama"
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
jive::block_on(async move {
|
||||
let app = axum::Router::new().route("/", axum::routing::get(hello));
|
||||
|
||||
hyperjive::server::builder(([0, 0, 0, 0], 8080)).await?.serve(app.into_make_service()).await?;
|
||||
|
||||
Ok(())
|
||||
})?
|
||||
}
|
Loading…
Reference in a new issue