aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_api/src/lib.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-07-05 15:27:29 -0700
committerFuwn <[email protected]>2021-07-05 15:27:29 -0700
commit60e9a0adebd231383979b49d864f65fe15483277 (patch)
tree6895f6bc09e59d29d98617d956337086368217d2 /crates/whirl_api/src/lib.rs
parentfeat(whirl_api): /api/v1/worlds/info endpoint (diff)
downloadwhirl-60e9a0adebd231383979b49d864f65fe15483277.tar.xz
whirl-60e9a0adebd231383979b49d864f65fe15483277.zip
refactor(whirl_api): route scoping
Diffstat (limited to 'crates/whirl_api/src/lib.rs')
-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();