1
use actix_web::{dev::HttpServiceFactory, web};
2

            
3
use super::super::{middleware::AuthService, State};
4

            
5
mod api;
6
mod request;
7
mod response;
8

            
9
1263
pub fn new_service(scope_path: &str, state: &State) -> impl HttpServiceFactory {
10
1263
    let auth_uri = format!("{}/api/v1/auth/tokeninfo", state.auth_base.as_str());
11
1263
    web::scope(scope_path)
12
1263
        .service(
13
1263
            web::resource("/count")
14
1263
                .wrap(AuthService::new(auth_uri.clone()))
15
1263
                .route(web::get().to(api::get_count)),
16
1263
        )
17
1263
        .service(
18
1263
            web::resource("/list")
19
1263
                .wrap(AuthService::new(auth_uri.clone()))
20
1263
                .route(web::get().to(api::get_list)),
21
1263
        )
22
1263
}