Changelog History
Page 2
-
v0.6.0 Changes
January 30, 2020๐ API Documentation
This patch introduces a new cookies API, based on the excellent ๐ cookie crate. Working with cookies is a staple for ๐ any web server, and Tide's new API now makes this entirely declarative.
โ Additionally we've added back CORS support. This makes it possible for ๐ง possible to configure the single-origin policy of browsers, which is an incredibly valuable resource.
๐ And finally nesting services with Tide has become even easier. Building on the APIs in 0.5.0, the manual song-and-dance required to nest APIs is no longer required, and services can now be nested as-is through the
Route::nest
API.Examples
Cookies
use cookie::Cookie; use tide::Response; let mut app = tide::new(); app.at("/").get(|req| async move { println!("cat snack: {:?}", req.cookie("snack")); Response::new(200) }); app.at("/set").get(|req| async move { let mut res = Response::new(200); res.set_cookie(Cookie::new("snack", "tuna")); res }); app.listen("127.0.0.1:8080").await?;
CORS
๐ Make GET, POST, and OPTIONS endpoints on this server accessible from any web page.
use http::header::HeaderValue; use tide::middleware::{Cors, Origin}; let rules = Cors::new() .allow_methods(HeaderValue::from_static("GET, POST, OPTIONS")) .allow_origin(Origin::from("*")) .allow_credentials(false); let mut app = tide::new(); app.middleware(rules); app.at("/").post(|_| async { Response::new(200) }); app.listen("localhost:8080").await?;
Nesting
Nest the inner serve inside the outer service, exposing
GET /cat/nori
.let mut inner = tide::new(); inner.at("/nori").get(|_| async { Response::new(200) }); let mut outer = tide::new(); outer.at("/cat").nest(inner); outer.listen("localhost:8080").await?;
โ Added
- โ Added
Route::all
to match all HTTP methods on a route (#379) - โ Added
Route::nest
to nest instances oftide::Server
on sub-routes (#379) - โ Added a new
cors
submodule containing CORS control middleware (#373) - โ Added
Request::cookie
to get a cookie sent by the client (#380) - โ Added
Response::set_cookie
to instruct the client to set a cookie (#380) - โ Added
Response::remove_cookie
to instruct the client to unset a cookie (#380)
๐ Changed
- ๐ Changed the behavior of optional params in
Request.query
to be more intuitive (384) - ๐ Improved the debugging experience of query deserialization errors (384)
- โก๏ธ Updated the GraphQL example to use the latest version of Juniper (#372)
- ๐จ Tide no longer prints to stdout when started (387)
๐ Fixed
- ๐ Fixed an incorrect MIME type definition on
Response::body
(378)
- โ Added
-
v0.5.1 Changes
December 20, 2019๐ API Documentation
๐ This fixes a rendering issue on docs.rs.
๐ Fixes
- ๐ Fix a rendering issue on docs.rs (#376)
-
v0.5.0 Changes
December 20, 2019๐ API Documentation
๐ This release introduces the ability to nest applications, add logging
๐ middleware, and improves our documentation.Nesting applications is a useful technique that can be used to create several
sub-applications. This allows creating clear points of isolation in applications
that can be used completely independently of the main application. But can be
recombined into a single binary if required.Being able to nest applications is also a necessary first step to re-introduce
per-route middleware, which we'll do in subsequent patches.Examples
let mut inner = tide::new(); inner.at("/").get(|\_| async { "root" }); inner.at("/foo").get(|\_| async { "foo" }); inner.at("/bar").get(|\_| async { "bar" });let mut outer = tide::new(); outer .at("/nested") .strip\_prefix() // catch /nested and /nested/\* .get(inner.into\_http\_service()); // the prefix /nested will be stripped here
โ Added
- โ Added
Route::strip_prefix
(#364) - โ Added the ability
Service
s to be nested (#364) - โ Added
middleware::RequestLogger
(#367)
๐ Changed
- ๐ Updated and improved the documentation (#363)
- โ Added
-
v0.4.0 Changes
November 26, 2019๐ This release is a further polishing of Tide's APIs, and works towards
significantly improving Tide's user experience. The biggest question left
unanswered after this patch is how we want to do error handling, but aside from
that the end-user API should be pretty close to where we want it to be.The biggest changes in this patch is endpoints now take
Request
instead of
Context
. The newRequest
andResponse
types are no longer type aliases but
concrete types, making them substantially easier to use. This also means that
we've been able to fold in all theExt
methods we were exposing, enabling
methods such aslet values: Schema = req.body_json()?;
to deserialize an
incoming JSON body through aSerde
schema. This should make it significantly
easier to write APIs with Tide out of the box.Example
Create a "hello world" app:
#[async\_std::main]async fn main() -\> Result\<(), std::io::Error\> { let mut app = tide::new(); app.at("/").get(|\_| async move { "Hello, world!" }); app.listen("127.0.0.1:8080").await?; Ok(()) }
Redirect from
/nori
to/chashu
:#[async\_std::main]async fn main() -\> Result\<(), std::io::Error\> { let mut app = tide::new(); app.at("/chashu").get(|\_| async move { "meow" }); app.at("/nori").get(tide::redirect("/chashu")); app.listen("127.0.0.1:8080").await?; Ok(()) }
โ Added
- โ Added
logger::RequestLogger
based onlog
(replaceslogger:RootLogger
). - โ Added
Request
with inherent methods (replacesContext
). - โ Added
Server
(replacesApp
). - โ Added
Response
(replacing a type alias of the same name). - โ Added a
prelude
submodule, holding all public traits. - โ Added a
new
free function, a shorthand forServer::new
. - ๐ Added a
with_state
free function, a shorthand forServer::with_state
. - โ Added
Result
type alias (replacesEndpointResult
). - โ Added a
redirect
free function to redirect from one endpoint to another.
๐ Changed
- โช Resolved an
#[allow(unused_mut)]
workaround. - ๐ Renamed
ExtractForms
toContextExt
. Response
is now a newly defined type.
โ Removed
- โ Removed
logger::RootLogger
(replaced bylogger:RequestLogger
). - โ Removed internal use of the
box_async
macro. - โ Removed
Context
(replaced byRequest
). - โ Removed the
Response
type alias (replaced by a newResponse
struct). - โ Removed
App
(replaced byServer
). - Temporarily disabled the multipart family of APIs, improving compilation
speed by ~30%. - โ Removed
EndpointResult
(replaced byResult
).
- โ Added
-
v0.3.0 Changes
October 31, 2019๐ This is the first release in almost 6 months; introducing a snapshot of where we ๐ were right before splitting up the crate. This release is mostly similar to
0.2.0
, but sets us up to start rewinding prior work on top.โ Added
- โ Added "unstable" feature flag.
- โ Added example for serving static files.
- โ Added keywords and categories to Cargo.toml.
- 0๏ธโฃ Implemented
Default
forApp
. - โ Added
App::with_state
constructor method. - โ Added
Context::state
(replacingRequest::app_data
) - โ Added examples to the documentation root.
- โ Added a section about stability guarantees to the documentation root.
๐ Changed
- ๐ Fixed multipart uploads.
- ๐ Fixed some doc tests.
- ๐ Rename
cookies::CookiesExt
tocookies::ContextExt
. - ๐ Rename
querystring::ExtractQuery
toquerystring::ContextExt
. - ๐ท Switched CI provider from Travis to GitHub actions.
- โก๏ธ Updated README.
- โก๏ธ Updated all dependencies.
- Replaced
AppData
withState
.
โ Removed
- โ Removed the RFCs subdirectory.
- โ Removed an extra incoming license requirement.
- โ Removed outdated version logs.
- โ Removed
rustfmt.toml
. - โ Removed
Request::app_data
(replaced withContext::state
).
-
v0.2.0 Changes
May 03, 2019๐ฒ Log not kept.
-
v0.1.1 Changes
April 18, 2019๐ฒ Log not kept.
-
v0.1.0 Changes
April 15, 2019๐ฒ Log not kept.
-
v0.0.5 Changes
February 26, 2019๐ฒ Log not kept.
-
v0.0.4 Changes
February 04, 2019๐ฒ Log not kept.