BLOG-56 refactor: rename as xxx_handler
in routes
This commit is contained in:
parent
c39a800b6b
commit
9dcefe90c5
@ -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<Arc<dyn PostController>>,
|
||||
query: web::Query<PostQueryDto>,
|
||||
) -> 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<Arc<dyn PostController>>,
|
||||
path: web::Path<i32>,
|
||||
) -> impl Responder {
|
||||
|
Loading…
x
Reference in New Issue
Block a user