mod request;
mod response;
mod shared_enums;

use std::{
    io::{BufReader, Write},
    net::TcpListener,
};

fn main() -> std::io::Result<()> {
    let listener = TcpListener::bind("127.0.0.1:8080")?;
    for incoming_stream in listener.incoming() {
        let stream = incoming_stream?;

        let reader = BufReader::new(&stream);

        let req = request::Request::from_bufreader(reader)?;

        let mut writer = stream;
        writer.write_all("Ok".as_bytes())?;
        writer.flush()?;
    }
    Ok(())
}
