@ -82,10 +82,11 @@ impl API<'_> {
println!("Start server on {} port", self.config.port);
// TODO: move it to "server"
let routes = login
.or(metrics)
//.or(segments)
.or(options)
let routes =
warp::path("api")
.and(
login.or(metrics).or(options))
.or(public)
.or(not_found);
warp::serve(routes).run(([127, 0, 0, 1], self.config.port)).await;
@ -21,7 +21,7 @@ struct SigninResp {
pub fn get_route(
user_service: Arc<RwLock<user_service::UserService>>,
) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
return warp::path!("api" / "auth" / "signin")
return warp::path!("auth" / "signin")
.and(post())
.and(warp::body::json())
.map(move |user: user_service::User| {
@ -66,7 +66,7 @@ async fn query(
metric_service: Arc<RwLock<metric_service::MetricService>>,
return warp::path!("api" / "metric")
return warp::path!("metric")
.and(get())
.and(warp::query::<HashMap<String, String>>())
.and(warp::any().map(move || metric_service.clone()))