tide 0.10.0

Serve the web – HTTP server framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[async_std::main]
async fn main() -> Result<(), std::io::Error> {
    let mut app = tide::new();
    app.at("/").get(|_| async move { Ok("Root") });
    app.at("/api").nest({
        let mut api = tide::new();
        api.at("/hello").get(|_| async move { Ok("Hello, world") });
        api.at("/goodbye")
            .get(|_| async move { Ok("Goodbye, world") });
        api
    });
    app.listen("127.0.0.1:8080").await?;
    Ok(())
}