rok 0.1.2

A stupid simple http web server framework base on hyper.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rok::{App, Request};

#[tokio::main]
async fn main() {
    let mut app = App::new();

    app.get("/ping", |_| async { "pong" });

    app.get("/hello/:echo", |req: Request| async move {
        let echo: String = req.get_param("echo").unwrap_or_default();

        format!("Hello, {}!", echo)
    });

    let port = ":8080";
    println!("start web server,listening {}", port);
    app.run("127.0.0.1".to_string() + port).await.unwrap();
}