use std::io; use std::net::TcpListener; use rusty_http::Http; use rusty_http::StatusCode; fn main() -> io::Result<()> { let listener = TcpListener::bind("127.0.0.1:8080")?; for stream in listener.incoming().filter_map(Result::ok) { let (request, response) = Http::from(stream)?; println!("New Request: "); println!("- method: {:?}", request.method); println!("- uri: {:?}", request.uri); println!("- params: {:?}", request.params); println!("- http_version: {:?}", request.http_version); println!("- headers: {:?}", request.headers); response.status_code(StatusCode::Ok) .set_header("Content-Type", "text/html").flush()? .add_to_body("

Hello from Rust!

").flush()?; } Ok(()) }