#tide #http #web #framework #async

tide

A minimal and pragmatic Rust web application framework built for rapid development

23 releases (15 breaking)

0.15.0 Nov 13, 2020
0.13.0 Jul 31, 2020
0.6.0 Jan 30, 2020
0.5.1 Dec 20, 2019
0.0.0 Aug 10, 2018

#6 in HTTP server

Download history 5424/week @ 2020-08-04 4287/week @ 2020-08-11 3024/week @ 2020-08-18 3700/week @ 2020-08-25 3156/week @ 2020-09-01 3848/week @ 2020-09-08 4299/week @ 2020-09-15 4124/week @ 2020-09-22 4539/week @ 2020-09-29 4015/week @ 2020-10-06 4203/week @ 2020-10-13 4458/week @ 2020-10-20 3434/week @ 2020-10-27 3325/week @ 2020-11-03 3063/week @ 2020-11-10 2511/week @ 2020-11-17

16,237 downloads per month
Used in 53 crates (51 directly)

MIT/Apache

175KB
3K SLoC

Tide

Serve the web

Tide is a minimal and pragmatic Rust web application framework built for rapid development. It comes with a robust set of features that make building async web applications and APIs easier and more fun.

Getting started

In order to build a web app in Rust you need an HTTP server, and an async runtime. After running cargo init add the following lines to your Cargo.toml file:

# Example, use the version numbers you need
tide = "0.14.0"
async-std = { version = "1.6.0", features = ["attributes"] }

Examples

Create an HTTP server that receives a JSON body, validates it, and responds with a confirmation message.

use tide::Request;
use tide::prelude::*;

#[derive(Debug, Deserialize)]
struct Animal {
    name: String,
    legs: u8,
}

#[async_std::main]
async fn main() -> tide::Result<()> {
    let mut app = tide::new();
    app.at("/orders/shoes").post(order_shoes);
    app.listen("127.0.0.1:8080").await?;
    Ok(())
}

async fn order_shoes(mut req: Request<()>) -> tide::Result {
    let Animal { name, legs } = req.body_json().await?;
    Ok(format!("Hello, {}! I've put in an order for {} shoes", name, legs).into())
}
$ curl localhost:8080/orders/shoes -d '{ "name": "Chashu", "legs": 4 }'
Hello, Chashu! I've put in an order for 4 shoes

$ curl localhost:8080/orders/shoes -d '{ "name": "Mary Millipede", "legs": 750 }'
number too large to fit in target type

See more examples in the examples directory.

Tide's design:

Community Resources

To add a link to this list, edit the markdown file and submit a pull request (github login required)
Listing here does not constitute an endorsement or recommendation from the tide team. Use at your own risk.

Listeners

Template engines

Routers

Auth

Testing

Middleware

Session Stores

Example applications

Contributing

Want to join us? Check out our The "Contributing" section of the guide and take a look at some of these issues:

Conduct

The Tide project adheres to the Contributor Covenant Code of Conduct. This describes the minimum behavior expected from all contributors.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~7–10MB
~200K SLoC