2018-12-08 13:44:55 +00:00
|
|
|
use failure::*;
|
2018-12-08 13:55:54 +00:00
|
|
|
//use std::collections::HashMap;
|
2018-12-08 13:44:55 +00:00
|
|
|
|
|
|
|
use crate::api::schema::*;
|
|
|
|
use crate::api::router::*;
|
|
|
|
use serde_json::{json, Value};
|
|
|
|
|
2018-12-08 13:51:08 +00:00
|
|
|
use crate::config::datastore;
|
|
|
|
|
2018-12-08 13:44:55 +00:00
|
|
|
fn datastore_list(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
|
|
|
|
println!("This is a test {}", param);
|
2018-12-08 13:51:08 +00:00
|
|
|
|
2018-12-09 09:23:19 +00:00
|
|
|
let config = datastore::config()?;
|
|
|
|
|
|
|
|
Ok(config.convert_to_array("id"))
|
2018-12-08 13:44:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn router() -> Router {
|
|
|
|
|
|
|
|
let route = Router::new()
|
|
|
|
.get(ApiMethod::new(
|
|
|
|
datastore_list,
|
|
|
|
ObjectSchema::new("Directory index.")));
|
|
|
|
|
|
|
|
route
|
|
|
|
}
|