diff --git a/src/main.rs b/src/main.rs index fb1e232..c96f99c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,8 +20,11 @@ fn handle_connection(mut stream: TcpStream) { println!("Request: {}", String::from_utf8_lossy(&buffer[..])); - let response = "HTTP/1.1 200 OK\r\n\r\n"; + let headers = "HTTP/1.1 200 OK\r\n\r\n".as_bytes(); + stream.write(headers).unwrap(); + let response = fs::read("public/index.html").unwrap(); + let response = &response[..]; - stream.write(response.as_bytes()).unwrap(); + stream.write(response).unwrap(); stream.flush().unwrap(); }