http_server_tiny 0.2.1

HTTP SERVER
Documentation
1
2
3
4
5
6
7
8
9
10
11
use http_server_tiny::{route, HttpServer, Method, Res};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut server = HttpServer::new("0.0.0.0:8000", "./static/error.html");
    route!(get_html => server, "/", "./static/index.html");
    route!(get_js => server, "/index.js", "./static/index.js");

    server.handle_requests(Box::new(|req| {
        println!("INFO: {} {}", req.method, req.url);
    }))
}