Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tide-test #273

Closed
wants to merge 80 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d67ec8f
isolate core revamp
prasannavl May 13, 2019
a50668f
Merge pull request #219 from prasannavl/2019_05_tide_isolate_core
prasannavl May 15, 2019
a376d60
Fix example link in readme
daleione May 15, 2019
c3066f7
Merge pull request #221 from daleione/readme
prasannavl May 15, 2019
be577ef
fix broken links in readme
prasannavl May 15, 2019
f4473d6
Rename `serve` to `run`, add asynchronous `serve`
tirr-c May 15, 2019
6078fc4
Run rustfmt
tirr-c May 15, 2019
059a8f8
add tide-compression crate
fairingrey May 15, 2019
77dd922
Merge pull request #203 from tirr-c/serve-future
fairingrey May 15, 2019
250c2b9
Merge remote-tracking branch 'upstream/master' into compression
fairingrey May 15, 2019
80f0af6
use run instead of serve
fairingrey May 15, 2019
962fddc
Update tide-compression/README.md
fairingrey May 15, 2019
b19eb2e
Check example in readme compiles during testing
Nemo157 May 15, 2019
3af12d9
Remove #[allow(unused_mut)]
taiki-e May 16, 2019
f7ba837
Merge pull request #229 from Nemo157/test-readme
fairingrey May 16, 2019
dac4493
Remove #[allow(unused_mut)] (#231)
fairingrey May 16, 2019
29cdf99
Merge remote-tracking branch 'upstream/master' into compression
fairingrey May 16, 2019
d64d063
Middleware-based compression and decompression (#194)
fairingrey May 16, 2019
4531977
Improve curl command consistency
pickfire May 17, 2019
bdc9fdf
Improve curl command consistency (#233)
fairingrey May 17, 2019
77b3a1c
Split tide into smaller crates (#220)
wafflespeanut May 19, 2019
85b85e9
Update travis configuration (#228)
Nemo157 May 19, 2019
e7a7dac
add tide-log
prasannavl May 20, 2019
1106a85
change deny attr to warn; consistent enforcement for all crates
prasannavl May 20, 2019
2878aba
Add ResultDynErrExt (#216)
updogliu May 20, 2019
4d6da98
remove remaining deny attrs
prasannavl May 20, 2019
011d0db
rename trait ExtractForms to ContextExt (#239)
fairingrey May 20, 2019
6637aaf
remove async box macro
yoshuawuyts May 20, 2019
e7703fd
rustfmt
yoshuawuyts May 20, 2019
4806db4
Fix broken links in readme (#242)
daleione May 20, 2019
114c17c
Sweep the cache before uploading it (#246)
Nemo157 May 20, 2019
0d8caa9
move tide/ to src/
yoshuawuyts May 20, 2019
e11f71a
fix examples
yoshuawuyts May 20, 2019
15eee77
fix tests
yoshuawuyts May 21, 2019
7a8a33b
remove certificate
yoshuawuyts May 21, 2019
3799be6
remove async box macro (#245)
fairingrey May 21, 2019
e30f184
remove `--manifest-path`
fairingrey May 21, 2019
731e27a
Merge branch 'master' into run-examples
fairingrey May 21, 2019
5ec263e
Bring tide to root, and allow `cargo run --example` (#247)
fairingrey May 21, 2019
4df808d
add tide-log (#222)
prasannavl May 21, 2019
d664194
remove certificate file (#248)
fairingrey May 21, 2019
4bd12ed
Merge branch 'master' into 2019_change_quality_enforcement
fairingrey May 21, 2019
79e37d8
Adjust code quality enforcement (#241)
fairingrey May 21, 2019
a9fbc58
feat: add type annotation
k-nasa May 21, 2019
424c605
fix clippy warnings (#249)
fairingrey May 21, 2019
e45a7e5
Update .travis.yml
fairingrey May 21, 2019
1a93fc2
Update juniper requirement from 0.11.1 to 0.12.0
dependabot-support May 21, 2019
8b06916
isolate tide-headers, tide-slog; better; improve loggers
prasannavl May 21, 2019
225a43d
add logging examples
prasannavl May 21, 2019
9e96166
Merge branch 'master' of ssh://github.com/rustasync/tide
prasannavl May 21, 2019
7d9e136
cargo fmt
prasannavl May 21, 2019
8aac219
add tide dev-dep to all crates
prasannavl May 21, 2019
f41754b
fixup manifest documentation links
prasannavl May 21, 2019
b47e780
pub use ResultDynErrExt in tide::error
updogliu May 21, 2019
476d75b
Update Cargo.toml
fairingrey May 21, 2019
f354835
capitalize Tide in crate desc
fairingrey May 21, 2019
82e990c
Core revamp part 2 (#252)
fairingrey May 21, 2019
d401db3
pub use ResultDynErrExt in tide::error (#253)
fairingrey May 21, 2019
34cb65c
refactor tide-forms, tide-querystring
prasannavl May 21, 2019
5c483ba
Fix the documentation for wildcards for path definitions to match imp…
May 21, 2019
60834dc
fix err_fmt macro
prasannavl May 21, 2019
d187372
fix querystring tests
prasannavl May 21, 2019
676132e
add basic crate level doc
prasannavl May 21, 2019
d15bb7a
cargo fmt
prasannavl May 21, 2019
c121673
Fix links in README
derekdreery May 21, 2019
8ac86ec
fix tide-slog keywords limit
prasannavl May 21, 2019
68c6cb7
Fix links in README (#256)
prasannavl May 21, 2019
ce2167a
Rename Context<Data> to Context<State>
Maniarr May 22, 2019
8b667fe
Merge pull request #260 from Maniarr/appdata_rename
fairingrey May 22, 2019
4d4ef6c
Merge branch 'master' into core_revamp_3
fairingrey May 22, 2019
32709f5
Merge pull request #254 from gameldar/master
fairingrey May 22, 2019
9fbd88f
propagate hyper error on serve failure
fairingrey May 22, 2019
d18c369
Core revamp part 3 (#255)
fairingrey May 23, 2019
3a0e592
Merge pull request #261 from fairingrey/propagate_hyper_error
fairingrey May 23, 2019
279e0f0
Add doc comment (#250)
k-nasa May 27, 2019
7c2046a
add test that checks for empty body on HEAD req (#179)
fairingrey Jun 5, 2019
2504828
Add middleware for catching panics (#265)
Nemo157 Jun 5, 2019
1fb4ab3
Implemented CORS header handler middleware (#262)
k-nasa Jun 6, 2019
4486ba0
Add templating example with tera (#267)
milesgranger Jun 6, 2019
a2e9e25
tide-test
yoshuawuyts Jun 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Repository.

- [Code of Conduct](#code-of-conduct)
- [Bad Actors](#bad-actors)
- [Developer Certificate of Origin](#developer-certificate-of-origin)

## Code of Conduct
The project has a [Code of Conduct](./CODE_OF_CONDUCT.md) that *all*
Expand Down Expand Up @@ -54,10 +53,3 @@ contributors the benefit of the doubt and having a sincere willingness to admit
that you *might* be wrong is critical for any successful open collaboration.

Don't be a bad actor.

## Developer Certificate of Origin
All contributors must read and agree to the [Developer Certificate of
Origin (DCO)](../CERTIFICATE).

The DCO allows us to accept contributions from people to the project, similarly
to how a license allows us to distribute our code.
65 changes: 54 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
language: rust
rust:
- nightly-2019-05-09

before_script: |
rustup component add rustfmt clippy
script: |
cargo fmt --all -- --check &&
cargo clippy --all -- -D clippy::all &&
cargo build --no-default-features --verbose &&
cargo build --all --verbose &&
cargo test --all --verbose
rust: nightly-2019-05-09
cache: cargo

before_script:
- >
[[ "$(cargo-sweep --version)" == "cargo-sweep 0.4.1" ]]
|| cargo install cargo-sweep
- cargo sweep --stamp

before_cache:
- cargo sweep --file

matrix:
include:
- name: cargo doc
env: [CACHE_NAME=docs]
script:
- RUSTDOCFLAGS=-Dwarnings cargo doc
-Zmtime-on-use
--all --all-features
--exclude tide
--no-deps

- name: cargo fmt
cache: false
before_script: []
install:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check

- name: cargo clippy
env: [CACHE_NAME=clippy]
install:
- rustup component add clippy
script:
- cargo clippy
-Zmtime-on-use
--all --all-targets
-- -Dwarnings

- name: cargo build --no-default-features
env: [CACHE_NAME=no-default-features]
script:
- cargo build
-Zmtime-on-use
--manifest-path tide-core/Cargo.toml
--no-default-features
- cargo build
-Zmtime-on-use
--no-default-features

- name: cargo test
script:
- cargo test -Zmtime-on-use --all --verbose
37 changes: 0 additions & 37 deletions CERTIFICATE

This file was deleted.

65 changes: 36 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,55 @@ readme = "README.md"
repository = "https://github.com/rustasync/tide"
version = "0.2.0"

[features]
default = ["hyper", "cookies", "cors"]
cookies = ["tide-cookies"]
cors = ["tide-cors"]
hyper = ["tide-core/http-service-hyper"]

[dependencies]
cookie = { version = "0.12", features = ["percent-encode"] }
futures-preview = "0.3.0-alpha.16"
fnv = "1.0.6"
http = "0.1"
http-service = "0.2.0"
pin-utils = "0.1.0-alpha.4"
route-recognizer = "0.1.12"
serde = "1.0.91"
serde_derive = "1.0.91"
serde_json = "1.0.39"
slog = "2.4.1"
slog-async = "2.3.0"
slog-term = "2.4.0"
typemap = "0.3.3"
serde_urlencoded = "0.5.5"

[dependencies.http-service-hyper]
optional = true
version = "0.2.0"

[dependencies.multipart]
default-features = false
features = ["server"]
version = "0.16.1"

[features]
default = ["hyper"]
hyper = ["http-service-hyper"]
tide-cookies = { path = "./tide-cookies", optional = true }
tide-cors = { path = "./tide-cors", optional = true }
tide-core = { path = "./tide-core" }
tide-headers = { path = "./tide-headers" }
tide-log = { path = "./tide-log" }
tide-forms = { path = "./tide-forms" }
tide-querystring = { path = "./tide-querystring" }
http-service-mock = "0.2.0"

[dev-dependencies]
basic-cookies = "0.1.3"
bytes = "0.4.12"
cookie = { version = "0.12", features = ["percent-encode"] }
futures-fs = "0.0.5"
futures-util-preview = { version = "0.3.0-alpha.16", features = ["compat"] }
http-service-mock = "0.2.0"
juniper = "0.11.1"
juniper = "0.12.0"
mime = "0.3.13"
mime_guess = "2.0.0-alpha.6"
percent-encoding = "1.0.1"
serde = { version = "1.0.90", features = ["derive"] }
structopt = "0.2.15"
serde = { version = "1.0.91", features = ["derive"] }
tera = "0.11"
tide-log = { path = "./tide-log" }
env_logger = "0.6.1"
log4rs = "0.8.3"
log = "0.4.6"

[workspace]
members = [
"tide-compression",
"tide-cookies",
"tide-core",
"tide-cors",
"tide-forms",
"tide-headers",
"tide-log",
"tide-querystring",
"tide-slog",
"tide-panic",
]

[patch.crates-io]
http-service = { git = "https://github.com/rustasync/http-service", branch = "master" }
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,27 @@ Ecosystem WG, and **not ready for production use yet**.

**Hello World**

```rust
```rust,no_run
#![feature(async_await)]

fn main() -> Result<(), std::io::Error> {
let mut app = tide::App::new();
app.at("/").get(async move |_| "Hello, world!");
Ok(app.serve("127.0.0.1:8000")?)
Ok(app.run("127.0.0.1:8000")?)
}
```

**More Examples**

- [Hello World](https://github.com/rustasync/tide/tree/master/examples/hello.rs)
- [Hello World](https://github.com/rustasync/tide/blob/master/examples/hello.rs)
- [Messages](https://github.com/rustasync/tide/blob/master/examples/messages.rs)
- [Body Types](https://github.com/rustasync/tide/blob/master/examples/body_types.rs)
- [Multipart Form](https://github.com/rustasync/tide/tree/master/examples/multipart-form/main.rs)
- [Catch All](https://github.com/rustasync/tide/tree/master/examples/catch_all.rs)
- [Cookies](https://github.com/rustasync/tide/tree/master/examples/cookies.rs)
- [Default Headers](https://github.com/rustasync/tide/tree/master/examples/default_headers.rs)
- [GraphQL](https://github.com/rustasync/tide/tree/master/examples/graphql.rs)
- [Multipart Form](https://github.com/rustasync/tide/blob/master/examples/multipart_form/mod.rs)
- [Catch All](https://github.com/rustasync/tide/blob/master/examples/catch_all.rs)
- [Cookies](https://github.com/rustasync/tide/blob/master/examples/cookies.rs)
- [Default Headers](https://github.com/rustasync/tide/blob/master/examples/default_headers.rs)
- [GraphQL](https://github.com/rustasync/tide/blob/master/examples/graphql.rs)
- [Staticfile](https://github.com/rustasync/tide/blob/master/examples/staticfile.rs)

## Resources

Expand Down
13 changes: 4 additions & 9 deletions examples/body_types.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#![feature(async_await)]

use serde::{Deserialize, Serialize};
use tide::{
error::ResultExt,
forms::{self, ExtractForms},
forms::{self, ContextExt},
response, App, Context, EndpointResult,
};

Expand All @@ -13,30 +12,26 @@ struct Message {
contents: String,
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_string(mut cx: Context<()>) -> String {
let msg = cx.body_string().await.unwrap();
println!("String: {}", msg);
msg
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_bytes(mut cx: Context<()>) -> Vec<u8> {
let msg = cx.body_bytes().await.unwrap();
println!("Bytes: {:?}", msg);
msg
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_json(mut cx: Context<()>) -> EndpointResult {
let msg = cx.body_json().await.client_err()?;
let msg: Message = cx.body_json().await.client_err()?;
println!("JSON: {:?}", msg);
Ok(response::json(msg))
}

#[allow(unused_mut)] // Workaround clippy bug
async fn echo_form(mut cx: Context<()>) -> EndpointResult {
let msg = cx.body_form().await?;
let msg: Message = cx.body_form().await?;
println!("Form: {:?}", msg);
Ok(forms::form(msg))
}
Expand All @@ -49,5 +44,5 @@ fn main() {
app.at("/echo/json").post(echo_json);
app.at("/echo/form").post(echo_form);

app.serve("127.0.0.1:8000").unwrap();
app.run("127.0.0.1:8000").unwrap();
}
3 changes: 1 addition & 2 deletions examples/catch_all.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(async_await)]

use tide::Context;

async fn echo_path(cx: Context<()>) -> String {
Expand All @@ -10,5 +9,5 @@ async fn echo_path(cx: Context<()>) -> String {
fn main() {
let mut app = tide::App::new();
app.at("/echo_path/*path").get(echo_path);
app.serve("127.0.0.1:8000").unwrap();
app.run("127.0.0.1:8000").unwrap();
}
6 changes: 1 addition & 5 deletions examples/cookies.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
#![feature(async_await)]

use cookie::Cookie;
use tide::{cookies::ContextExt, middleware::CookiesMiddleware, Context};

/// Tide will use the the `Cookies`'s `Extract` implementation to build this parameter.
///
async fn retrieve_cookie(mut cx: Context<()>) -> String {
format!("hello cookies: {:?}", cx.get_cookie("hello").unwrap())
}

#[allow(unused_mut)] // Workaround clippy bug
async fn set_cookie(mut cx: Context<()>) {
cx.set_cookie(Cookie::new("hello", "world")).unwrap();
}

#[allow(unused_mut)] // Workaround clippy bug
async fn remove_cookie(mut cx: Context<()>) {
cx.remove_cookie(Cookie::named("hello")).unwrap();
}
Expand All @@ -26,5 +22,5 @@ fn main() {
app.at("/").get(retrieve_cookie);
app.at("/set").get(set_cookie);
app.at("/remove").get(remove_cookie);
app.serve("127.0.0.1:8000").unwrap();
app.run("127.0.0.1:8000").unwrap();
}
2 changes: 1 addition & 1 deletion examples/default_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ fn main() {

app.at("/").get(async move |_| "Hello, world!");

app.serve("127.0.0.1:8000").unwrap();
app.run("127.0.0.1:8000").unwrap();
}
Loading