From 5337f7f61db26cb506ed1b1ec04b43366a4a6acc Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Fri, 7 Oct 2022 00:31:00 +0800 Subject: [PATCH] feat: add hatter-test --- __shuttle/README.md | 8 ++++++++ __shuttle/hatter-test/Cargo.toml | 11 +++++++++++ __shuttle/hatter-test/src/lib.rs | 14 ++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 __shuttle/hatter-test/Cargo.toml create mode 100644 __shuttle/hatter-test/src/lib.rs diff --git a/__shuttle/README.md b/__shuttle/README.md index f0f3d93..18444cc 100644 --- a/__shuttle/README.md +++ b/__shuttle/README.md @@ -3,7 +3,15 @@ cargo install cargo-shuttle ``` +Init +``` +cargo shuttle init --axum --name +``` +Deploy +``` +cargo shuttle deploy +``` Reference: diff --git a/__shuttle/hatter-test/Cargo.toml b/__shuttle/hatter-test/Cargo.toml new file mode 100644 index 0000000..66c3f40 --- /dev/null +++ b/__shuttle/hatter-test/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "hatter-test" +version = "0.1.0" +edition = "2021" + +[lib] + +[dependencies] +shuttle-service = { version = "0.5.2", features = ["web-axum"] } +axum = "0.5.16" +sync_wrapper = "0.1.1" diff --git a/__shuttle/hatter-test/src/lib.rs b/__shuttle/hatter-test/src/lib.rs new file mode 100644 index 0000000..b6b2d6d --- /dev/null +++ b/__shuttle/hatter-test/src/lib.rs @@ -0,0 +1,14 @@ +use axum::{routing::get, Router}; +use sync_wrapper::SyncWrapper; + +async fn hello_world() -> &'static str { + "Hello, world!" +} + +#[shuttle_service::main] +async fn axum() -> shuttle_service::ShuttleAxum { + let router = Router::new().route("/hello", get(hello_world)); + let sync_wrapper = SyncWrapper::new(router); + + Ok(sync_wrapper) +} \ No newline at end of file