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())
|
cfg.data(app_data.clone())
|
||||||
.service(
|
.service(
|
||||||
web::scope("/api")
|
web::scope("/api")
|
||||||
.service(routes::users::get_user)
|
.service(
|
||||||
.service(routes::users::get_all_users)
|
web::scope("/users")
|
||||||
.service(web::scope("/get").route(
|
.route(
|
||||||
|
"",
|
||||||
|
web::get().to(routes::users::get_all_users),
|
||||||
|
)
|
||||||
|
.route(
|
||||||
|
"/{user_id}",
|
||||||
|
web::get().to(routes::users::get_user),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.route(
|
||||||
"/build-info",
|
"/build-info",
|
||||||
web::get().to(routes::misc::build_info_req),
|
web::get().to(routes::misc::build_info_req),
|
||||||
)),
|
),
|
||||||
)
|
)
|
||||||
// .route("/api/users/get", web::get().to(user_controller.get_user.into()))
|
// .route("/api/users/get", web::get().to(user_controller.get_user.into()))
|
||||||
.service(web::scope("/api/public")) // public endpoint - not implemented yet
|
.service(web::scope("/api/public")) // public endpoint - not implemented yet
|
||||||
|
@ -7,7 +7,6 @@ use actix_web::error::ResponseError;
|
|||||||
use validator::Validate;
|
use validator::Validate;
|
||||||
|
|
||||||
/// Finds user by UID.
|
/// Finds user by UID.
|
||||||
#[get("/get/users/{user_id}")]
|
|
||||||
pub async fn get_user(
|
pub async fn get_user(
|
||||||
app_data: web::Data<AppData>,
|
app_data: web::Data<AppData>,
|
||||||
user_id: web::Path<i32>,
|
user_id: web::Path<i32>,
|
||||||
@ -50,7 +49,6 @@ pub async fn get_user2(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/get/users")]
|
|
||||||
pub async fn get_all_users(
|
pub async fn get_all_users(
|
||||||
app_data: web::Data<AppData>,
|
app_data: web::Data<AppData>,
|
||||||
) -> Result<HttpResponse, DomainError> {
|
) -> Result<HttpResponse, DomainError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user