rustigo 1.1.4

A Rust webserver inspired by the Go standard library's HTTPServer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use rustigo::prelude::*;
use std::thread;
use std::time::Duration;

fn index(stream: TcpStream, _: Request) {
    html!(stream; "<h1>Sleeping</h1>");
    thread::sleep(Duration::from_secs(5));
}

fn main() {
    let mut rustigo = Rustigo::default();

    rustigo.handle("/", index);

    rustigo.listen("localhost:7878", 4).unwrap();
}