tide is a pragmatic Rust web app framework built for rapid development. It comes with a robust set of features that make building async web apps and APIs easier and more fun. It is part of the http-rs project and a counterpart to the surf HTTP client. Check out the docs or join us on Zulip.
Overview
This release includes a new serve_file method on Route, more ToListener implementations, and new initiatives.
Route::serve_file
Tide has had support for Route::serve_dir for several releases now. However sometimes it's nice to be able to quickly serve a file from a single file from a route. For that purpose we're introducing today.
This isn't the end of the road for asset serving in tide though; we recognize the need to support more complex asset pipelines in production settings. We expect to eventually kick off an initiative around this; but in the meantime Route::serve_file is a nice convenience for those who want it.
More ToListener implementations
Tide's Server::listen function operates using a ToListener trait, which works much like std::net::ToSocketAddr: it's implemented on a variety of strings, tuples, and concrete types to provide a great deal of flexibility in how it's initialized.
In this patch we're introducing ToListener on three more types: &String, (String, u16) and (&String, u16). This allows for much easier integration with CLI parsers such as structopt, requiring fewer conversions:
use structopt::StructOpt;
#[derive(structopt::StructOpt)]
struct Opts {
host: String,
port: u16,
}
#[async_std]
async fn main() -> tide::Result<()> {
let opts = Opts::from_args();
let mut app = tide::new();
app.listen((opts.host, opts.port)).await?; // this now works without conversions!
Ok(())
New Initiatives
Last week we released the last minor version of the http-types 2.x family, and the merge window for http-types 3.x has opened up. This is an effort which will take several weeks of work and planning to see through to success; but we're excited being able to smooth out some of the rough patches we've uncovered in http-types over the past year. The work here has been scoped out, and we've started to make good progress on it.
Once that's over however, it is probably time to revisit the question of a Tide 1.0 release. Over the past year Tide's core design has mostly remained stable; but added plenty of features improvements. However we're noticing two things:
Not all facilities included in Tide are quite where we'd like them to be.
Tide being on 0.x and publishing regular breaking releases makes it hard to build ecosystem libraries
For that purpose we're likely to split some parts of Tide we're less happy about into libraries (looking at you tide::log), and spend some time iterating them outside of the release cycle of Tide itself. We hope this will enable more people to experiment in the ecosystem, mature features faster, and enable more people to contribute to Tide and the wider http-rs ecosystem.
Added
Add serve_file method to route #725
Add more ToListener implementations #749
Add simple state example #742
docs: add tide-sqlx to readme #754
Fixed
In serve_dir, only strip the prefix from the start of the path once. #734
docs: Do not inline docs from deps that drift #753
docs: Fix port in curl invocation in example. #764
docs: Update version numbers of deps for README example #765
docs: Add missing serde requirement in example #782
docs: Fix Route::serve_dir docs #750
Internal
deps: Reduce dependencies when cookies not enabled #780
deps: Update async-h1 to v2.3.0 #767
deps: Update log to use kv_unstable_std instead of std #776
ci: Run clippy, docs and fmt checks on stable #756