Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the example module code #94

Merged
merged 3 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading