use xitca_web::{ App, handler::handler_service, middleware::Logger, middleware::{compress::Compress, decompress::Decompress}, route::get, }; async fn root() -> &'static str { "aslkdm" } use argh::FromArgs; #[derive(FromArgs)] /// Official OSAKA server implementation struct CLIArgs { /// server IP (default: 0.0.0.0) #[argh(option)] host: Option, /// server port (default: 80) #[argh(option)] port: Option, } fn main() -> std::io::Result<()> { let cli_args: CLIArgs = argh::from_env(); let addr = format!( "{}:{}", cli_args.host.unwrap_or("0.0.0.0".to_string()), cli_args.port.unwrap_or(80) ); App::new() .at("/", get(handler_service(root))) .enclosed(Compress) .enclosed(Decompress) .enclosed(Logger::new()) .serve() .bind(addr)? .run() .wait() }