#rocket #web #framework #server

nightly rocket

Web framework for nightly with a focus on ease-of-use, expressibility, and speed

36 releases

0.3.16 Aug 24, 2018
0.3.15 Jul 16, 2018
0.3.14 Jun 23, 2018
0.3.6 Jan 13, 2018
0.1.3 Dec 31, 2016

#3 in HTTP server

Download history 1977/week @ 2018-09-19 3057/week @ 2018-09-26 3317/week @ 2018-10-03 2735/week @ 2018-10-10 2137/week @ 2018-10-17 2319/week @ 2018-10-24 2839/week @ 2018-10-31 2986/week @ 2018-11-07 3138/week @ 2018-11-14 3224/week @ 2018-11-21 2439/week @ 2018-11-28 3099/week @ 2018-12-05 3693/week @ 2018-12-12

10,232 downloads per month
Used in 77 crates (76 directly)

MIT/Apache

1MB
11K SLoC


lib.rs:

Rocket - Core API Documentation

Hello, and welcome to the core Rocket API documentation!

This API documentation is highly technical and is purely a reference. There's an overview of Rocket on the main site as well as a full, detailed guide. If you'd like pointers on getting started, see the quickstart or getting started chapters of the guide.

You may also be interested in looking at the rocket_contrib documentation, which contains automatic JSON (de)serialiazation, templating support, static file serving, and other useful features.

Libraries

Rocket's functionality is split into two crates:

  1. Core - This core library. Needed by every Rocket application.
  2. Contrib - Provides useful functionality for many Rocket applications. Completely optional.

Usage

First, depend on rocket in Cargo.toml:

[dependencies]
rocket = "0.4.0"

Then, add the following to the top of your main.rs file:

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;
# #[get("/")] fn hello() { }
# fn main() { rocket::ignite().mount("/", routes![hello]); }

See the guide for more information on how to write Rocket applications. Here's a simple example to get you started:

#![feature(proc_macro_hygiene, decl_macro)]

#[macro_use] extern crate rocket;

#[get("/")]
fn hello() -> &'static str {
    "Hello, world!"
}

fn main() {
# if false { // We don't actually want to launch the server in an example.
    rocket::ignite().mount("/", routes![hello]).launch();
# }
}

Configuration

Rocket and Rocket libraries are configured via the Rocket.toml file and/or ROCKET_{PARAM} environment variables. For more information on how to configure Rocket, see the configuration section of the guide as well as the [config] module documentation.

Testing

The [local] module contains structures that facilitate unit and integration testing of a Rocket application. The top-level [local] module documentation and the testing chapter of the guide include detailed examples.

Types that map to concepts in HTTP.

This module exports types that map to HTTP concepts or to the underlying HTTP library when needed.

Dependencies

~9MB
~242K SLoC