A web framework for Rust.
Go to file
Sergio Benitez dcb150bde7 Something works! A simple hacked-up handler, that is.
At the moment, I simply install the first route I see into the Rocket struct
directly. This is quite terrible. What's worse is that I assume that the Route's
path and handler are static! The handler, actually, does have to be static, but
its response may have whatever (valid) lifetime, though I'm not sure anything
but `static makes sense. I'll think about it.

In any case, the weird `static` restrictions need to be removed, and I need to
think about which lifetimes are safe here. IE: Must all routes be static? Can I
use a closure as a route? (that'd be neat). If so, how do we make that work?

In any case, it's nice to see SOMETHING work. Yay!
2016-03-15 00:41:22 -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/hello Something works! A simple hacked-up handler, that is. 2016-03-15 00:41:22 -07:00
lib Something works! A simple hacked-up handler, that is. 2016-03-15 00:41:22 -07:00
macros Something works! A simple hacked-up handler, that is. 2016-03-15 00:41:22 -07:00
.gitignore Rocket is almost operational! `routes!` macro complete. 2016-03-12 10:45:19 -08:00
README.md Update example. 2016-03-14 20:46:55 -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")]
fn hello() -> &'static str {
    "Hello, world!"
}

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

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