From 030cc2a903d7fbfe9968ab007a3a6af293c692e4 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 4 Jan 2019 10:32:27 +0100 Subject: [PATCH] move admin API to /admin/ subfolder --- src/api3.rs | 6 +++--- src/api3/admin.rs | 18 ++++++++++++++++++ src/api3/{ => admin}/datastore.rs | 0 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/api3/admin.rs rename src/api3/{ => admin}/datastore.rs (100%) diff --git a/src/api3.rs b/src/api3.rs index fea385a3..6b5dc087 100644 --- a/src/api3.rs +++ b/src/api3.rs @@ -5,8 +5,8 @@ use crate::api::router::*; use serde_json::{json, Value}; pub mod config; +pub mod admin; mod version; -mod datastore; fn test_sync_api_handler(param: Value, _info: &ApiMethod) -> Result { println!("This is a test {}", param); @@ -54,13 +54,13 @@ pub fn router() -> Router { .get(ApiMethod::new( |_,_| Ok(json!([ {"subdir": "config"}, - {"subdir": "datastore"}, + {"subdir": "admin"}, {"subdir": "version"}, {"subdir": "nodes"} ])), ObjectSchema::new("Directory index."))) + .subdir("admin", admin::router()) .subdir("config", config::router()) - .subdir("datastore", datastore::router()) .subdir("version", version::router()) .subdir("nodes", nodes); diff --git a/src/api3/admin.rs b/src/api3/admin.rs new file mode 100644 index 00000000..7302f191 --- /dev/null +++ b/src/api3/admin.rs @@ -0,0 +1,18 @@ +use crate::api::schema::*; +use crate::api::router::*; +use serde_json::{json}; + +pub mod datastore; + +pub fn router() -> Router { + + let route = Router::new() + .get(ApiMethod::new( + |_,_| Ok(json!([ + {"subdir": "datastore"} + ])), + ObjectSchema::new("Directory index."))) + .subdir("datastore", datastore::router()); + + route +} diff --git a/src/api3/datastore.rs b/src/api3/admin/datastore.rs similarity index 100% rename from src/api3/datastore.rs rename to src/api3/admin/datastore.rs