use std::collections::HashMap;
use water_http::{InitControllersRoot, WaterController};
use water_http::server::ServerConfigurations;
type MainHolderType = HashMap<String,String>;
InitControllersRoot!{
name:MAIN_ROOT,
holder_type:MainHolderType,
}
fn main(){
let config = ServerConfigurations::bind("127.0.0.1",8084);
water_http::RunServer!(
config,
MAIN_ROOT,
MainController
);
}
WaterController! {
holder -> super::MainHolderType,
name -> MainController,
functions -> {
GET => public/{allRestPath} => main(context) async {
let path = format!("./public{}",allRestPath);
let result = context.send_file(http::FileRSender::new(path.as_ref())).await;
println!("invoked {:?}",result);
}
}
}