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