refactor routing
This commit is contained in:
parent
4d1118eb36
commit
aa6b788669
17
src/lib.rs
17
src/lib.rs
@ -54,12 +54,21 @@ pub fn configure_app(app_data: AppData) -> Box<dyn Fn(&mut ServiceConfig)> {
|
||||
cfg.data(app_data.clone())
|
||||
.service(
|
||||
web::scope("/api")
|
||||
.service(routes::users::get_user)
|
||||
.service(routes::users::get_all_users)
|
||||
.service(web::scope("/get").route(
|
||||
.service(
|
||||
web::scope("/users")
|
||||
.route(
|
||||
"",
|
||||
web::get().to(routes::users::get_all_users),
|
||||
)
|
||||
.route(
|
||||
"/{user_id}",
|
||||
web::get().to(routes::users::get_user),
|
||||
),
|
||||
)
|
||||
.route(
|
||||
"/build-info",
|
||||
web::get().to(routes::misc::build_info_req),
|
||||
)),
|
||||
),
|
||||
)
|
||||
// .route("/api/users/get", web::get().to(user_controller.get_user.into()))
|
||||
.service(web::scope("/api/public")) // public endpoint - not implemented yet
|
||||
|
@ -7,7 +7,6 @@ use actix_web::error::ResponseError;
|
||||
use validator::Validate;
|
||||
|
||||
/// Finds user by UID.
|
||||
#[get("/get/users/{user_id}")]
|
||||
pub async fn get_user(
|
||||
app_data: web::Data<AppData>,
|
||||
user_id: web::Path<i32>,
|
||||
@ -50,7 +49,6 @@ pub async fn get_user2(
|
||||
}
|
||||
}
|
||||
|
||||
#[get("/get/users")]
|
||||
pub async fn get_all_users(
|
||||
app_data: web::Data<AppData>,
|
||||
) -> Result<HttpResponse, DomainError> {
|
||||
|
Loading…
Reference in New Issue
Block a user