diff --git a/example/src/http_method.rs b/example/src/http_method.rs index d757c92..029834a 100644 --- a/example/src/http_method.rs +++ b/example/src/http_method.rs @@ -8,8 +8,8 @@ struct User { } #[summer_boot::get("/hello")] -pub async fn hello(mut _req: Request<()>) -> Result { - Ok(format!("Hello, Summer Boot").into()) +pub async fn hello(_req: Request<()>) -> Result { + Ok("Hello, Summer Boot".to_string().into()) } #[summer_boot::post("/user/getUserInfo")] diff --git a/example/src/lib.rs b/example/src/lib.rs index 8b13789..b9e7325 100644 --- a/example/src/lib.rs +++ b/example/src/lib.rs @@ -1 +1,2 @@ - +mod read_yml; +mod log; \ No newline at end of file diff --git a/example/src/main.rs b/example/src/main.rs index 6b74717..c768851 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -2,7 +2,6 @@ use serde::Deserialize; use summer_boot::{Request, Result}; mod http_method; -mod test; #[derive(Debug, Deserialize)] struct User { diff --git a/example/src/read_yml.rs b/example/src/read_yml.rs index 0ee877a..54df35f 100644 --- a/example/src/read_yml.rs +++ b/example/src/read_yml.rs @@ -110,4 +110,22 @@ mod tests { println!("mysqlConfig:{}", serde_json::to_string(&a.mysql).unwrap()); }); } + + #[test] + fn load_env_file_test() { + // let file = File::open("example/src/resources").expect("找不到文件"); + let file_name = "application.yml"; + let directories = vec!["src/resources", "spring-boot/src/resources", "dir3"]; + + for directory in directories { + let path = format!("{}/{}", directory, file_name); + let file_exists = std::fs::metadata(&path).is_ok(); + + if file_exists { + println!("文件 {} 存在于目录 {}", file_name, directory); + } else { + println!("文件 {} 不存在于目录 {}", file_name, directory); + } + } + } } diff --git a/example/src/test.rs b/example/src/test.rs deleted file mode 100644 index b6e65b0..0000000 --- a/example/src/test.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[test] -fn test() { - // let file = File::open("example/src/resources").expect("找不到文件"); - let file_name = "application.yml"; - let directories = vec!["src/resources", "spring-boot/src/resources", "dir3"]; - - for directory in directories { - let path = format!("{}/{}", directory, file_name); - let file_exists = std::fs::metadata(&path).is_ok(); - - if file_exists { - println!("文件 {} 存在于目录 {}", file_name, directory); - } else { - println!("文件 {} 不存在于目录 {}", file_name, directory); - } - } -}