move admin API to /admin/ subfolder

This commit is contained in:
Dietmar Maurer 2019-01-04 10:32:27 +01:00
parent b663789bdb
commit 030cc2a903
3 changed files with 21 additions and 3 deletions

View File

@ -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<Value, Error> {
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);

18
src/api3/admin.rs Normal file
View File

@ -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
}