From 9dcefe90c57b9ba22a00ba38ad6813bda0eebf26 Mon Sep 17 00:00:00 2001 From: "Yu Squire[ Yu, Tsung-Ying ]" Date: Tue, 1 Jul 2025 11:33:13 +0800 Subject: [PATCH] BLOG-56 refactor: rename as `xxx_handler` in routes --- .../feature/post/src/framework/web/post_web_routes.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/feature/post/src/framework/web/post_web_routes.rs b/backend/feature/post/src/framework/web/post_web_routes.rs index 4f099dc..b403829 100644 --- a/backend/feature/post/src/framework/web/post_web_routes.rs +++ b/backend/feature/post/src/framework/web/post_web_routes.rs @@ -8,11 +8,14 @@ use crate::{ }; pub fn configure_post_routes(cfg: &mut web::ServiceConfig) { - cfg.service(web::resource("/post_info").route(web::get().to(get_all_post_info))); - cfg.service(web::resource("/post/{id}").route(web::get().to(get_full_post))); + cfg.service( + web::scope("/post") + .route("/all", web::get().to(get_all_post_info_handler)) + .route("/{id}", web::get().to(get_full_post_handler)), + ); } -async fn get_all_post_info( +async fn get_all_post_info_handler( post_controller: web::Data>, query: web::Query, ) -> impl Responder { @@ -28,7 +31,7 @@ async fn get_all_post_info( } } -async fn get_full_post( +async fn get_full_post_handler( post_controller: web::Data>, path: web::Path, ) -> impl Responder {