A web framework for Rust.
Go to file
Sergio Benitez fb8fdc3bc2 Cleaned up response -> split into files. Started form example.
There's something going on with Hyper. When a 303 (see other) response is sent
in response to a POST, the browser does a GET to the location header. Hyper
somehow misreads the method parameter here, resulting in a route failer.

I need to MITM the connection to see exactly what the browser is sending and
what Hyper is receiving to see who's wrong.
2016-03-28 02:34:09 -07:00
docs Initial commit. Checking for method and path arguments in route. Not storing the info anywhere yet. 2016-03-07 11:28:04 -08:00
examples Cleaned up response -> split into files. Started form example. 2016-03-28 02:34:09 -07:00
lib Cleaned up response -> split into files. Started form example. 2016-03-28 02:34:09 -07:00
macros Cleaned up response -> split into files. Started form example. 2016-03-28 02:34:09 -07:00
scripts Added a travis file. 2016-03-17 20:18:16 -07:00
.gitignore Rocket is almost operational! `routes!` macro complete. 2016-03-12 10:45:19 -08:00
.travis.yml Added a travis file. 2016-03-17 20:18:16 -07:00
README.md Updated README with more thorough example. 2016-03-17 19:56:23 -07:00

README.md

Rocket

Rocket is a work-in-progress web framework for Rust (nightly) with a focus on ease-of-use, expressability, and speed. It currently does not work. But, when it does, the following will be the canonical "Hello, world!" example:

#![feature(plugin)]
#![plugin(rocket_macros)]

extern crate rocket;
use rocket::Rocket;

#[route(GET, path = "/hello/<name>")]
fn hello(name: &'static str) -> String {
    format!("Hello, {}!", name)
}

fn main() {
    let mut rocket = Rocket::new("localhost", 8000);
    rocket.mount_and_launch("/", routes![hello]);
}

Rocket requires a nightly version of Rust as it makes heavy use of syntax extensions. This also means that the first two unwieldly lines in the Rust file above are required.

Building

Try running the examples in the examples/ folder. For instance, the following sequence of commands builds the Hello, world! example:

cd examples/hello
cargo build
cargo run

Then visit localhost:8000/hello/{some_name}, replacing {some_name} with some name.

OS X

Apple has stopped shipping openssl with OS X.11. As such, if your build fails compile, you'll need to install openssl, cargo clean, and then cargo build again. Here are some lightweight instructions:

brew install openssl
brew link --force openssl
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib