Skip to content

Commit

Permalink
Merge pull request #94 from Jzow/master
Browse files Browse the repository at this point in the history
Modify the example module code
  • Loading branch information
wansenai-bot authored Dec 27, 2023
2 parents d4e4799 + 021b1fd commit b03c070
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions example/src/http_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
3 changes: 2 additions & 1 deletion example/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

mod read_yml;
mod log;
1 change: 0 additions & 1 deletion example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use serde::Deserialize;
use summer_boot::{Request, Result};

mod http_method;
mod test;

#[derive(Debug, Deserialize)]
struct User {
Expand Down
18 changes: 18 additions & 0 deletions example/src/read_yml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
17 changes: 0 additions & 17 deletions example/src/test.rs

This file was deleted.

0 comments on commit b03c070

Please sign in to comment.