use std::path::PathBuf; use json::{JsonValue, object}; use df_helper::files::file; use df_helper::http::web::{Web}; fn main() { let root_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let root_path = root_path.to_str().unwrap(); let conf = file::file_content_get_json(format!("{}/tests/config/web.json", root_path.clone()).as_str()); Web::bind(conf["url"].as_str().unwrap(), format!("{}/tests/public", root_path.clone()).as_str(), ).run(conf["cors"].clone(), handle); fn handle(response: JsonValue) -> (JsonValue, i32, String) { println!("{:#}", response); let text = object! {"name":"2313",response:response}; return (text, 200, "json".to_string()); } }