|
1 | | -use actix_web::{web, App, HttpServer, middleware::Logger}; |
2 | | -use file_classification_core::utils::database::establish_connection; |
3 | | -mod handlers; |
4 | | -mod utils; |
5 | | -#[actix_web::main] |
6 | | -async fn main() -> std::io::Result<()> { |
7 | | - env_logger::init(); |
8 | | - |
9 | | - println!("正在启动文件分类 Web API..."); |
10 | | - |
11 | | - HttpServer::new(|| { |
12 | | - App::new() |
13 | | - .app_data(web::Data::new(establish_connection())) |
14 | | - .wrap(Logger::default()) |
15 | | - .service(handlers::files::api_list_files) |
16 | | - .service(handlers::files::api_list_files_by_conditions) |
17 | | - // .service(handlers::files::api_create_file) |
18 | | - .service(handlers::files::api_update_files_by_conditions) |
19 | | - .service(handlers::files::api_delete_file) |
20 | | - .service(handlers::groups::api_list_groups) |
21 | | - .service(handlers::groups::api_list_groups_by_conditions) |
22 | | - .service(handlers::groups::api_create_group) |
23 | | - .service(handlers::groups::api_update_groups_by_conditions) |
24 | | - .service(handlers::groups::api_delete_group) |
25 | | - .service(handlers::tags::api_list_tags) |
26 | | - .service(handlers::tags::api_list_tags_by_conditions) |
27 | | - .service(handlers::tags::api_create_tag) |
28 | | - .service(handlers::tags::api_update_tags_by_conditions) |
29 | | - .service(handlers::tags::api_delete_tag) |
30 | | - .service(handlers::file_groups::api_list_file_groups_by_conditions) |
31 | | - .service(handlers::file_groups::api_create_file_group) |
32 | | - .service(handlers::file_groups::api_delete_file_group) |
33 | | - .service(handlers::group_tags::api_list_group_tags_by_conditions) |
34 | | - .service(handlers::group_tags::api_create_group_tag) |
35 | | - .service(handlers::group_tags::api_delete_group_tag) |
36 | | - }) |
37 | | - .bind("127.0.0.1:8080")? |
38 | | - .run() |
39 | | - .await |
40 | | -} |
| 1 | +use actix_web::{web, App, HttpServer, middleware::Logger}; |
| 2 | +use file_classification_core::utils::database::establish_connection; |
| 3 | +mod handlers; |
| 4 | +mod utils; |
| 5 | +#[actix_web::main] |
| 6 | +async fn main() -> std::io::Result<()> { |
| 7 | + env_logger::init(); |
| 8 | + |
| 9 | + println!("正在启动文件分类 Web API..."); |
| 10 | + |
| 11 | + HttpServer::new(|| { |
| 12 | + App::new() |
| 13 | + .app_data(web::Data::new(establish_connection())) |
| 14 | + .wrap(Logger::default()) |
| 15 | + .service(handlers::files::api_list_files) |
| 16 | + .service(handlers::files::api_list_files_by_conditions) |
| 17 | + // .service(handlers::files::api_create_file) |
| 18 | + .service(handlers::files::api_update_files_by_conditions) |
| 19 | + .service(handlers::files::api_delete_file) |
| 20 | + .service(handlers::groups::api_list_groups) |
| 21 | + .service(handlers::groups::api_list_groups_by_conditions) |
| 22 | + .service(handlers::groups::api_create_group) |
| 23 | + .service(handlers::groups::api_update_groups_by_conditions) |
| 24 | + .service(handlers::groups::api_delete_group) |
| 25 | + .service(handlers::tags::api_list_tags) |
| 26 | + .service(handlers::tags::api_list_tags_by_conditions) |
| 27 | + .service(handlers::tags::api_create_tag) |
| 28 | + .service(handlers::tags::api_update_tags_by_conditions) |
| 29 | + .service(handlers::tags::api_delete_tag) |
| 30 | + .service(handlers::file_groups::api_list_file_groups_by_conditions) |
| 31 | + .service(handlers::file_groups::api_create_file_group) |
| 32 | + .service(handlers::file_groups::api_delete_file_group) |
| 33 | + .service(handlers::group_tags::api_list_group_tags_by_conditions) |
| 34 | + .service(handlers::group_tags::api_create_group_tag) |
| 35 | + .service(handlers::group_tags::api_delete_group_tag) |
| 36 | + }) |
| 37 | + .bind("127.0.0.1:8080")? |
| 38 | + .run() |
| 39 | + .await |
| 40 | +} |
0 commit comments