use std::net::TcpListener;
use std::net::TcpStream;
-use std::fs;
-use std::str;
+use std::time::Duration;
+use std::{fs, str, thread};
fn handle_connection(mut stream: TcpStream) {
let mut buffer = [0; 1024];
let (code, file) = if path == "/" || path == "/index.html" {
("200 OK", "index.html")
+ } else if path == "/slow" {
+ thread::sleep(Duration::from_secs(5));
+ ("200 OK", "index.html")
} else {
("404 NOT FOUND", "404.html")
};