fix: 调整路由顺序,修复静态文件被JWT拦截的问题
- 将 /static/{tail:.*} 路由移到受保护 scope 之前
- 确保静态文件无需认证即可访问
This commit is contained in:
26
src/handlers/mod.rs
Normal file
26
src/handlers/mod.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
// handlers 模块 - 按功能拆分路由处理器
|
||||
pub mod admin;
|
||||
pub mod auth;
|
||||
pub mod health;
|
||||
pub mod static_files;
|
||||
pub mod user;
|
||||
pub mod weather;
|
||||
|
||||
// 编译时嵌入目录(供 handlers 使用)
|
||||
pub use include_dir::{Dir, include_dir};
|
||||
pub static STATIC_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/static");
|
||||
pub static TEMPLATES_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/templates");
|
||||
|
||||
// re-export handlers for convenient use in main.rs
|
||||
pub use admin::admin_get_user;
|
||||
pub use admin::admin_update_user_payment;
|
||||
pub use auth::login;
|
||||
pub use health::health_check;
|
||||
pub use static_files::serve_static_files;
|
||||
pub use user::get_current_user_profile;
|
||||
pub use user::save_user_profile;
|
||||
pub use weather::delete_weather;
|
||||
pub use weather::generate_temp_token_handler;
|
||||
pub use weather::get_weather_brief;
|
||||
pub use weather::get_weather_details;
|
||||
pub use weather::post_weather_data;
|
||||
Reference in New Issue
Block a user