aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_api
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-07-05 15:27:29 +0000
committerFuwn <[email protected]>2021-07-05 15:27:29 +0000
commitcdd24e6836bcab9060640939794d6fa2d857e432 (patch)
tree0b798fe22214080cbc2d30a22dfded527009b291 /crates/whirl_api
parentfeat(whirl_api): /api/v1/worlds/info endpoint (diff)
downloadwhirl-cdd24e6836bcab9060640939794d6fa2d857e432.tar.xz
whirl-cdd24e6836bcab9060640939794d6fa2d857e432.zip
refactor(whirl_api): route scoping
Diffstat (limited to 'crates/whirl_api')
-rw-r--r--crates/whirl_api/src/lib.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/whirl_api/src/lib.rs b/crates/whirl_api/src/lib.rs
index a72df55..e89d891 100644
--- a/crates/whirl_api/src/lib.rs
+++ b/crates/whirl_api/src/lib.rs
@@ -30,7 +30,7 @@ extern crate log;
#[macro_use]
extern crate serde_derive;
-use actix_web::web::resource;
+use actix_web::web::{resource, scope};
mod routes;
@@ -55,9 +55,15 @@ impl Api {
actix_web::App::new()
.wrap(actix_cors::Cors::default().allow_any_origin())
.service(resource("/").to(|| async { "Whirlsplash" }))
- .service(resource("/api/v1/statistics").to(routes::stats::statistics))
- .service(resource("/api/v1/worlds/vip").to(routes::worlds::vip::vip))
- .service(resource("/api/v1/worlds/info").to(routes::worlds::info::info))
+ .service(
+ scope("/api/v1")
+ .service(resource("/statistics").to(routes::stats::statistics))
+ .service(
+ scope("/worlds")
+ .service(resource("/vip").to(routes::worlds::vip::vip))
+ .service(resource("/info").to(routes::worlds::info::info)),
+ ),
+ )
})
.bind(address)?
.run();