touche 0.0.15

Synchronous HTTP library
Documentation
1
2
3
4
5
6
7
8
9
10
11
use touche::{Response, Server, StatusCode};

fn main() -> std::io::Result<()> {
    let mut counter = 0;
    Server::bind("0.0.0.0:4444").serve_single_thread(|_| {
        counter += 1;
        Response::builder()
            .status(StatusCode::OK)
            .body(format!("Request count: {}", counter))
    })
}