diff --git a/Cargo.toml b/Cargo.toml index d2d81bd..b03527a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,5 @@ members = [ "summer-boot-actuator", "summer-boot-autoconfigure", "summer-boot-macro", - "example", -] + "example" +] \ No newline at end of file diff --git a/example/Cargo.toml b/example/Cargo.toml index f97c28d..2470e00 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -18,4 +18,4 @@ schemars = "0.8.8" tokio = { version = "1.19.2", features = ["full"] } #summer -summer-boot = { version = "1.0.0", path = "../summer-boot" } +summer-boot = { version = "1.0.0"} \ No newline at end of file diff --git a/example/src/log.rs b/example/src/log.rs index f210ce7..627e0d9 100644 --- a/example/src/log.rs +++ b/example/src/log.rs @@ -1,4 +1,4 @@ -use summer_boot::log; + #[cfg(test)] mod test { diff --git a/example/src/main.rs b/example/src/main.rs index e0fb6c9..f01eb4a 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -1,7 +1,21 @@ -mod http_method; +use serde::Deserialize; +use summer_boot::{Request, Result}; + + +#[derive(Debug, Deserialize)] +struct User { + name: String, + age: u16, +} #[summer_boot::auto_scan] #[summer_boot::main] async fn main() { summer_boot::run(); +} + +#[summer_boot::post("/test/api")] +async fn test_api(mut req: Request<()>) -> Result { + let User { name, age } = req.body_json().await?; + Ok(format!("Hello, {}! {} years old", name, age).into()) } \ No newline at end of file diff --git a/summer-boot-autoconfigure/src/read_yml.rs b/summer-boot-autoconfigure/src/read_yml.rs index 1e073b3..5e22777 100644 --- a/summer-boot-autoconfigure/src/read_yml.rs +++ b/summer-boot-autoconfigure/src/read_yml.rs @@ -201,4 +201,4 @@ pub fn load_conf() -> Option { return load_global_config(init.profiles.active); } None -} +} \ No newline at end of file