From fc1b40177df68de1c9833a0454974a20dba8cf62 Mon Sep 17 00:00:00 2001 From: Fankai Liu Date: Sun, 26 Nov 2023 21:39:46 +0800 Subject: [PATCH] refactor code --- src/utils/create_project.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/create_project.rs b/src/utils/create_project.rs index 6c6fe78..eef2ffc 100644 --- a/src/utils/create_project.rs +++ b/src/utils/create_project.rs @@ -249,11 +249,11 @@ pub fn write_project_file( let mut db_templates = vec![ ("src/db.rs", include_str!("../template/src/db.hbs")), ( - "src/router/user.rs", + "src/routers/user.rs", include_str!("../template/src/routers/user.hbs"), ), ( - "src/router/static_routers.rs", + "src/routers/static_routers.rs", include_str!("../template/src/routers/static_routers.hbs"), ), ( @@ -541,11 +541,10 @@ pub fn write_project_file( let users_json_bytes = include_bytes!("../template/data/users.json"); let mut users_json_file = File::create(data_path.join("users.json"))?; users_json_file.write_all(users_json_bytes)?; - templates.append(&mut db_templates); } + templates.append(&mut db_templates); } for (file_name, template) in &templates { - dbg!(&project_path.join(file_name)); render_and_write_to_file(&handlebars, template, &data, project_path.join(file_name))?; } Ok(())