use hyper::Body; use log::info; use thruster::context::basic_hyper_context::{ generate_context, BasicHyperContext as Ctx, HyperRequest, }; use thruster::unix_hyper_server::UnixHyperServer; use thruster::{m, middleware_fn}; use thruster::{App, ThrusterServer}; use thruster::{MiddlewareNext, MiddlewareResult}; #[middleware_fn] async fn plaintext(mut context: Ctx, _next: MiddlewareNext) -> MiddlewareResult { let val = "Hello, World!"; context.body = Body::from(val); Ok(context) } fn main() { env_logger::init(); info!("Starting server..."); let app = App::::create(generate_context, ()).get("/plaintext", m![plaintext]); UnixHyperServer::new(app).start("/tmp/thruster.sock", 0); }