Now using a Cargo workspace for (much!) faster builds. Added a temporary query

params example.
This commit is contained in:
Sergio Benitez 2016-08-10 17:50:08 -07:00
parent df9b71bee7
commit 025c9243c0
16 changed files with 66 additions and 2 deletions

16
Cargo.toml Normal file
View File

@ -0,0 +1,16 @@
[workspace]
members = [
"examples/cookies",
"examples/errors",
"examples/extended_validation",
"examples/forms",
"examples/hello_person",
"examples/hello_query_params",
"examples/hello_world",
"examples/manual_routes",
"examples/optional_redirect",
"examples/optional_result",
"examples/redirect",
"examples/static_files",
"examples/todo",
]

View File

@ -2,6 +2,7 @@
name = "cookies" name = "cookies"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "errors" name = "errors"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "extended_validation" name = "extended_validation"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "forms" name = "forms"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "hello_person" name = "hello_person"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -0,0 +1,9 @@
[package]
name = "hello_query"
version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies]
rocket = { path = "../../lib" }
rocket_macros = { path = "../../macros" }

View File

@ -0,0 +1,28 @@
#![feature(plugin)]
#![plugin(rocket_macros)]
extern crate rocket;
use rocket::{Rocket, Error};
// One idea of what we could get.
// #[route(GET, path = "/hello?{name,age}")]
// fn hello(name: &str, age: &str) -> String {
// "Hello!".to_string()
// // format!("Hello, {} year old named {}!", age, name)
// }
// Another idea.
// #[route(GET, path = "/hello")]
// fn hello(q: QueryParams) -> IOResult<String> {
// format!("Hello, {} year old named {}!", q.get("name")?, q.get("age")?)
// }
#[route(GET, path = "/hello")]
fn hello() -> &'static str {
"Hello there! Don't have query params yet, but we're working on it."
}
fn main() {
Rocket::new("localhost", 8000).mount_and_launch("/", routes![hello]);
}

View File

@ -2,6 +2,7 @@
name = "hello_world" name = "hello_world"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "manual_routes" name = "manual_routes"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -1,7 +1,8 @@
[package] [package]
name = "optional_result" name = "optional_redirect"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "optional_result" name = "optional_result"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "redirect" name = "redirect"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "static_files" name = "static_files"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -2,6 +2,7 @@
name = "todo" name = "todo"
version = "0.0.1" version = "0.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"] authors = ["Sergio Benitez <sb@sergio.bz>"]
workspace = "../../"
[dependencies] [dependencies]
rocket = { path = "../../lib" } rocket = { path = "../../lib" }

View File

@ -17,7 +17,6 @@ function build_and_test() {
pushd ${dir} pushd ${dir}
echo ":: Building '${PWD}'..." echo ":: Building '${PWD}'..."
cargo clean
cargo build --verbose cargo build --verbose
echo ":: Running unit tests in '${PWD}'..." echo ":: Running unit tests in '${PWD}'..."