diff options
| author | Fuwn <[email protected]> | 2021-07-05 15:27:29 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-07-05 15:27:29 +0000 |
| commit | cdd24e6836bcab9060640939794d6fa2d857e432 (patch) | |
| tree | 0b798fe22214080cbc2d30a22dfded527009b291 /crates/whirl_api | |
| parent | feat(whirl_api): /api/v1/worlds/info endpoint (diff) | |
| download | whirl-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.rs | 14 |
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(); |