2018-10-29 03:12:46 +00:00
|
|
|
|
###############################################################################
|
|
|
|
|
# Release info: displayed between bars in the header
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[release]
|
2023-11-03 23:26:07 +00:00
|
|
|
|
version = "0.5.0"
|
2023-11-13 01:21:46 +00:00
|
|
|
|
date = "Nov 17, 2023"
|
2018-10-29 03:12:46 +00:00
|
|
|
|
|
2017-04-17 02:48:59 +00:00
|
|
|
|
###############################################################################
|
|
|
|
|
# Top features: displayed in the header under the introductory text.
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[[top_features]]
|
|
|
|
|
title = "Type Safe"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
text = "Type safety turned up to 11 means security and robustness come at compile-time."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = "helmet"
|
|
|
|
|
button = "Learn More"
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = "overview/#how-rocket-works"
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = "69px"
|
|
|
|
|
height = "71px"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
[[top_features]]
|
|
|
|
|
title = "Boilerplate Free"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
text = "Spend your time writing code that really matters and let Rocket handle the rest."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = "robot-free"
|
|
|
|
|
button = "See Examples"
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = "overview/#anatomy-of-a-rocket-application"
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = "78px"
|
|
|
|
|
height = "71px"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
[[top_features]]
|
|
|
|
|
title = "Easy To Use"
|
2018-10-26 10:32:50 +00:00
|
|
|
|
text = "Simple, intuitive APIs make Rocket approachable, no matter your background."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = "sun"
|
|
|
|
|
button = "Get Started"
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = "guide"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
margin = 2
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = "68px"
|
|
|
|
|
height = "69px"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
[[top_features]]
|
|
|
|
|
title = "Extensible"
|
2018-10-26 10:32:50 +00:00
|
|
|
|
text = "Create your own first-class primitives that any Rocket application can use."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = "telescope"
|
|
|
|
|
button = "See How"
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = "overview/#anatomy-of-a-rocket-application"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
margin = 9
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = "71px"
|
|
|
|
|
height = "62px"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
# Sections: make sure there are an odd number so colors work out.
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[[sections]]
|
|
|
|
|
title = "Hello, Rocket!"
|
|
|
|
|
code = '''
|
2018-10-05 04:44:42 +00:00
|
|
|
|
#[macro_use] extern crate rocket;
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
#[get("/hello/<name>/<age>")]
|
2021-03-27 23:25:39 +00:00
|
|
|
|
fn hello(name: &str, age: u8) -> String {
|
2017-04-17 02:48:59 +00:00
|
|
|
|
format!("Hello, {} year old named {}!", age, name)
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-16 12:01:26 +00:00
|
|
|
|
#[launch]
|
2021-04-14 04:59:11 +00:00
|
|
|
|
fn rocket() -> _ {
|
2021-04-08 08:07:52 +00:00
|
|
|
|
rocket::build().mount("/", routes![hello])
|
2017-04-17 02:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
'''
|
|
|
|
|
text = '''
|
|
|
|
|
This is a **complete Rocket application**. It does exactly what you would
|
2021-06-27 00:10:57 +00:00
|
|
|
|
expect. If you were to visit **/hello/John/58**, you’d see:
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
<span class="callout">Hello, 58 year old named John!</span>
|
|
|
|
|
|
|
|
|
|
If someone visits a path with an `<age>` that isn’t a `u8`, Rocket doesn’t
|
2023-11-22 20:38:53 +00:00
|
|
|
|
just call `hello`. Instead, it tries other matching routes or returns a
|
2017-04-17 02:48:59 +00:00
|
|
|
|
**404**.
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[sections]]
|
|
|
|
|
title = "Forms? Check!"
|
|
|
|
|
code = '''
|
|
|
|
|
#[derive(FromForm)]
|
2021-03-27 23:25:39 +00:00
|
|
|
|
struct Task<'r> {
|
2021-06-27 00:10:57 +00:00
|
|
|
|
#[field(validate = len(1..))]
|
2021-03-27 23:25:39 +00:00
|
|
|
|
description: &'r str,
|
2017-04-17 02:48:59 +00:00
|
|
|
|
completed: bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[post("/", data = "<task>")]
|
2021-03-27 23:25:39 +00:00
|
|
|
|
fn new(task: Form<Task<'_>>) -> Flash<Redirect> {
|
2021-06-27 00:10:57 +00:00
|
|
|
|
Flash::success(Redirect::to(uri!(home)), "Task added.")
|
2017-04-17 02:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
'''
|
|
|
|
|
text = '''
|
2021-06-27 00:10:57 +00:00
|
|
|
|
Form handling **is simple, declarative, and complete**: derive
|
|
|
|
|
[`FromForm`](@api/rocket/derive.FromForm.html) for your structure and set the
|
|
|
|
|
`data` parameter to a `Form` type. Rocket automatically **parses and
|
|
|
|
|
validates** the form data into your structure and calls your function.
|
|
|
|
|
|
2023-11-22 20:38:53 +00:00
|
|
|
|
File uploads? A breeze with [`TempFile`](@api/rocket/fs/enum.TempFile.html).
|
2021-06-27 00:10:57 +00:00
|
|
|
|
Bad form request? Rocket doesn’t call your function! Need to know what went
|
|
|
|
|
wrong? Use a `data` parameter of `Result`! Want to rerender the form with user
|
2023-11-22 20:38:53 +00:00
|
|
|
|
input and errors? Use [`Context`](guide/requests/#context)!
|
2017-04-17 02:48:59 +00:00
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[sections]]
|
2023-11-22 20:38:53 +00:00
|
|
|
|
title = "JSON, always on."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
code = '''
|
|
|
|
|
#[derive(Serialize, Deserialize)]
|
2021-03-27 23:25:39 +00:00
|
|
|
|
struct Message<'r> {
|
|
|
|
|
contents: &'r str,
|
2017-04-17 02:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-26 10:32:50 +00:00
|
|
|
|
#[put("/<id>", data = "<msg>")]
|
2021-06-27 00:10:57 +00:00
|
|
|
|
fn update(db: &Db, id: Id, msg: Json<Message<'_>>) -> Value {
|
2018-10-22 21:47:35 +00:00
|
|
|
|
if db.contains_key(&id) {
|
2021-03-27 23:25:39 +00:00
|
|
|
|
db.insert(id, msg.contents);
|
2017-08-26 06:14:42 +00:00
|
|
|
|
json!({ "status": "ok" })
|
2017-04-17 02:48:59 +00:00
|
|
|
|
} else {
|
2017-08-26 06:14:42 +00:00
|
|
|
|
json!({ "status": "error" })
|
2017-04-17 02:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
'''
|
|
|
|
|
text = '''
|
|
|
|
|
Rocket has first-class support for JSON, right out of the box. Simply derive
|
|
|
|
|
`Deserialize` or `Serialize` to receive or return JSON, respectively.
|
|
|
|
|
|
2021-06-27 00:10:57 +00:00
|
|
|
|
Look familiar? Forms, JSON, and all kinds of body data types work through
|
|
|
|
|
Rocket’s [`FromData`](@api/rocket/data/trait.FromData.html) trait, Rocket’s
|
|
|
|
|
approach to deriving types from body data. A `data` route parameter can be
|
|
|
|
|
_any_ type that implements `FromData`. A value of that type will be
|
|
|
|
|
deserialized automatically from the incoming request body. You can even
|
|
|
|
|
implement `FromData` for your own types!
|
2017-04-17 02:48:59 +00:00
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2022-09-07 12:42:21 +00:00
|
|
|
|
# Bottom features: displayed above the footer.
|
2017-04-17 02:48:59 +00:00
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
|
|
|
|
title = 'Templating'
|
2018-10-22 21:47:35 +00:00
|
|
|
|
text = "Rocket makes templating a breeze with built-in templating support."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = 'templating-icon'
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = 'guide/responses/#templates'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
button = 'Learn More'
|
|
|
|
|
color = 'blue'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '101px'
|
|
|
|
|
height = '52px'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
|
|
|
|
title = 'Cookies'
|
2017-07-10 11:59:55 +00:00
|
|
|
|
text = "View, add, or remove cookies, with or without encryption, without hassle."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = 'cookies-icon'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '72px'
|
|
|
|
|
height = '58px'
|
2018-10-16 05:50:35 +00:00
|
|
|
|
url = 'guide/requests/#cookies'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
button = 'Learn More'
|
2023-11-22 20:38:53 +00:00
|
|
|
|
color = 'fucsia'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
margin = -6
|
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
2023-11-22 20:38:53 +00:00
|
|
|
|
title = 'WebSockets + Streams'
|
2021-06-09 09:53:11 +00:00
|
|
|
|
text = "Create and return potentially infinite async streams of data with ease."
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = 'streams-icon'
|
2021-06-09 09:53:11 +00:00
|
|
|
|
url = 'guide/responses/#async-streams'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
button = 'Learn More'
|
|
|
|
|
color = 'red'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '82px'
|
|
|
|
|
height = '81px'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
margin = -29
|
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
2021-06-09 09:53:11 +00:00
|
|
|
|
title = 'Config Profiles'
|
|
|
|
|
text = "Configure your application your way for debug, release, or anything else!"
|
2017-04-17 02:48:59 +00:00
|
|
|
|
image = 'config-icon'
|
2021-06-09 09:53:11 +00:00
|
|
|
|
url = 'guide/configuration/#profiles'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
button = 'Learn More'
|
|
|
|
|
color = 'yellow'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '57px'
|
|
|
|
|
height = '57px'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
margin = -3
|
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
2023-11-22 20:38:53 +00:00
|
|
|
|
title = 'Type-Checked URIs'
|
|
|
|
|
text = "Never mistype or forget to update a URI again with Rocket's typed URIs."
|
|
|
|
|
image = 'pencil-icon'
|
|
|
|
|
url = 'guide/requests/#private-cookies'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
button = 'Learn More'
|
2018-10-22 21:47:35 +00:00
|
|
|
|
color = 'orange'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '60px'
|
2023-11-22 20:38:53 +00:00
|
|
|
|
height = '60px'
|
|
|
|
|
margin = -3
|
2018-10-22 21:47:35 +00:00
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
2023-11-22 20:38:53 +00:00
|
|
|
|
title = 'Structured Middleware'
|
|
|
|
|
text = "Fairings are Rocket's simpler approach to structured middleware."
|
2018-10-22 21:47:35 +00:00
|
|
|
|
image = 'ship-icon'
|
2023-11-22 20:38:53 +00:00
|
|
|
|
url = 'guide/fairings/#fairings'
|
2018-10-22 21:47:35 +00:00
|
|
|
|
button = 'Learn More'
|
2017-04-17 02:48:59 +00:00
|
|
|
|
color = 'green'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '98px'
|
|
|
|
|
height = '74px'
|
2018-10-22 21:47:35 +00:00
|
|
|
|
margin = -20
|
|
|
|
|
|
2023-11-22 20:38:53 +00:00
|
|
|
|
[[bottom_features]]
|
|
|
|
|
title = 'Database Support'
|
|
|
|
|
text = "Store data with ease with Rocket's built-in ORM agnostic database support."
|
|
|
|
|
image = 'query-icon'
|
|
|
|
|
url = 'guide/state/#databases'
|
|
|
|
|
button = 'Learn More'
|
|
|
|
|
color = 'pink'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '73px'
|
|
|
|
|
height = '57px'
|
2023-11-22 20:38:53 +00:00
|
|
|
|
margin = -3
|
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
|
|
|
|
title = 'Testing'
|
|
|
|
|
text = "Unit and integration test using the comprehensive, built-in testing library."
|
|
|
|
|
image = 'testing-icon'
|
|
|
|
|
url = 'guide/testing#testing'
|
|
|
|
|
button = 'Learn More'
|
|
|
|
|
color = 'aqua'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '47px'
|
|
|
|
|
height = '54px'
|
2023-11-22 20:38:53 +00:00
|
|
|
|
|
|
|
|
|
[[bottom_features]]
|
|
|
|
|
title = 'Community'
|
|
|
|
|
text = "Join an extensive community of 20,000+ Rocketeers that love Rocket."
|
|
|
|
|
image = 'globe'
|
|
|
|
|
url = 'https://github.com/rwf2/Rocket/network/dependents'
|
|
|
|
|
button = 'See Dependents'
|
|
|
|
|
color = 'purple'
|
2023-12-08 21:59:21 +00:00
|
|
|
|
width = '55px'
|
|
|
|
|
height = '55px'
|
|
|
|
|
margin = -1
|
2023-11-22 20:38:53 +00:00
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
# Panels: displayed in a tabbed arrangement.
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Routing"
|
|
|
|
|
checked = true
|
|
|
|
|
content = '''
|
|
|
|
|
Rocket's main task is to route incoming requests to the appropriate request
|
|
|
|
|
handler using your application's declared routes. Routes are declared using
|
|
|
|
|
Rocket's _route_ attributes. The attribute describes the requests that match the
|
|
|
|
|
route. The attribute is placed on top of a function that is the request handler
|
|
|
|
|
for that route.
|
|
|
|
|
|
|
|
|
|
As an example, consider the simple route below:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[get("/")]
|
|
|
|
|
fn index() -> &'static str {
|
|
|
|
|
"Hello, world!"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This `index` route matches any incoming HTTP `GET` request to `/`, the index.
|
|
|
|
|
The handler returns a `String`. Rocket automatically converts the string into a
|
|
|
|
|
well-formed HTTP response that includes the appropriate `Content-Type` and body
|
|
|
|
|
encoding metadata.
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Dynamic Params"
|
|
|
|
|
content = '''
|
|
|
|
|
Rocket automatically parses dynamic data in path segments into any desired type.
|
|
|
|
|
To illustrate, let's use the following route:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[get("/hello/<name>/<age>")]
|
|
|
|
|
fn hello(name: &str, age: u8) -> String {
|
|
|
|
|
format!("Hello, {} year old named {}!", age, name)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This `hello` route has two dynamic parameters, identified with angle brackets,
|
|
|
|
|
declared in the route URI: `<name>` and `<age>`. Rocket maps each parameter to
|
|
|
|
|
an identically named function argument: `name: &str` and `age: u8`. The dynamic
|
|
|
|
|
data in the incoming request is parsed automatically into a value of the
|
|
|
|
|
argument's type. The route is called only when parsing succeeds.
|
|
|
|
|
|
|
|
|
|
Parsing is directed by the
|
|
|
|
|
[`FromParam`](@api/rocket/request/trait.FromParam.html) trait. Rocket implements
|
|
|
|
|
`FromParam` for many standard types, including both `&str` and `u8`. You can
|
|
|
|
|
implement it for your own types, too!
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Handling Data"
|
|
|
|
|
content = '''
|
|
|
|
|
Rocket can automatically parse body data, too!
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[post("/login", data = "<login>")]
|
|
|
|
|
fn login(login: Form<UserLogin>) -> String {
|
|
|
|
|
format!("Hello, {}!", login.name)
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The dynamic parameter declared in the `data` route attribute parameter again
|
|
|
|
|
maps to a function argument. Here, `login` maps to `login: Form<UserLogin>`.
|
|
|
|
|
Parsing is again trait-directed, this time by the
|
|
|
|
|
[`FromData`](@api/rocket/data/trait.FromData.html) trait.
|
|
|
|
|
|
|
|
|
|
The [`Form`](@api/rocket/form/struct.Form.html) type is Rocket's [robust form
|
|
|
|
|
data parser](@guide/requests/#forms). It automatically parses the request body into the internal type,
|
|
|
|
|
here `UserLogin`. Other built-in `FromData` types include
|
|
|
|
|
[`Data`](@api/rocket/struct.Data.html),
|
|
|
|
|
[`Json`](@api/rocket/serde/json/struct.Json.html), and
|
|
|
|
|
[`MsgPack`](@api/rocket/serde/msgpack/struct.MsgPack.html). As always, you can
|
|
|
|
|
implement `FromData` for your own types, too!
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Request Guards"
|
|
|
|
|
content = '''
|
|
|
|
|
In addition to dynamic path and data parameters, request handlers can also
|
|
|
|
|
contain a third type of parameter: _request guards_. Request guards aren't
|
|
|
|
|
declared in the route attribute, and any number of them can appear in the
|
|
|
|
|
request handler signature.
|
|
|
|
|
|
|
|
|
|
Request guards _protect_ the handler from running unless some set of conditions
|
|
|
|
|
are met by the incoming request metadata. For instance, if you are writing an
|
|
|
|
|
API that requires sensitive calls to be accompanied by an API key in the request
|
|
|
|
|
header, Rocket can protect those calls via a custom `ApiKey` request guard:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[get("/sensitive")]
|
|
|
|
|
fn sensitive(key: ApiKey) { ... }
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`ApiKey` protects the `sensitive` handler from running incorrectly. In order for
|
|
|
|
|
Rocket to call the `sensitive` handler, the `ApiKey` type needs to be derived
|
|
|
|
|
through a [`FromRequest`](@api/rocket/request/trait.FromRequest.html)
|
|
|
|
|
implementation, which in this case, validates the API key header. Request guards
|
|
|
|
|
are a powerful and unique Rocket concept; they centralize application policy and
|
|
|
|
|
invariants through types.
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Responders"
|
|
|
|
|
content = '''
|
|
|
|
|
The return type of a request handler can be any type that implements
|
|
|
|
|
[`Responder`](@api/rocket/response/trait.Responder.html):
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[get("/")]
|
|
|
|
|
fn route() -> T { ... }
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Above, T must implement `Responder`. Rocket implements `Responder` for many of
|
|
|
|
|
the standard library types including `&str`, `String`, `File`, `Option`, and
|
|
|
|
|
`Result`. Rocket also implements custom responders such as
|
|
|
|
|
[`Redirect`](@api/rocket/response/struct.Redirect.html),
|
|
|
|
|
[`Flash`](@api/rocket/response/struct.Flash.html), and
|
|
|
|
|
[`Template`](@api/rocket_dyn_templates/struct.Template.html).
|
|
|
|
|
|
|
|
|
|
The task of a `Responder` is to generate a
|
|
|
|
|
[`Response`](@api/rocket/response/struct.Response.html), if possible.
|
|
|
|
|
`Responder`s can fail with a status code. When they do, Rocket calls the
|
|
|
|
|
corresponding error catcher, a `catch` route, which can be declared as follows:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[catch(404)]
|
|
|
|
|
fn not_found() -> T { ... }
|
|
|
|
|
```
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[panels]]
|
|
|
|
|
name = "Launching"
|
|
|
|
|
content = '''
|
|
|
|
|
Finally, we get to launch our application! Rocket begins dispatching requests to
|
|
|
|
|
routes after they've been _mounted_ and the application has been _launched_.
|
|
|
|
|
These two steps, usually wrtten in a `rocket` function, look like:
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
#[launch]
|
|
|
|
|
fn rocket() -> _ {
|
|
|
|
|
rocket::build().mount("/base", routes![index, another])
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The `mount` call takes a _base_ and a set of routes via the `routes!` macro. The
|
|
|
|
|
base path (`/base` above) is prepended to the path of every route in the list,
|
|
|
|
|
effectively namespacing the routes. `#[launch]` creates a `main` function that
|
|
|
|
|
starts the server. In development, Rocket prints useful information to the
|
|
|
|
|
console to let you know everything is okay.
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
🚀 Rocket has launched from http://127.0.0.1:8000
|
|
|
|
|
```
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
# Sponsors
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
[sponsors.diamond]
|
|
|
|
|
name = "💎 Diamond"
|
|
|
|
|
tag = "$500/month"
|
|
|
|
|
color = "#addcde"
|
2023-12-13 02:10:49 +00:00
|
|
|
|
height = "110px"
|
|
|
|
|
|
|
|
|
|
[[sponsors.diamond.sponsors]]
|
|
|
|
|
name = "Kindness"
|
|
|
|
|
url = "https://kindness.ai"
|
|
|
|
|
img = "kindness.png"
|
|
|
|
|
blurb = "Supporting customers with Kindness"
|
|
|
|
|
width = "110px"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
|
|
|
|
|
[sponsors.gold]
|
|
|
|
|
name = "💛 Gold"
|
|
|
|
|
tag = "$250/month"
|
|
|
|
|
color = "#fffbba"
|
|
|
|
|
height = "55px"
|
|
|
|
|
|
|
|
|
|
[[sponsors.gold.sponsors]]
|
|
|
|
|
name = "ohne-makler"
|
|
|
|
|
url = "https://www.ohne-makler.net/"
|
|
|
|
|
img = "ohne-makler.svg"
|
2023-12-13 02:10:49 +00:00
|
|
|
|
width = "173px"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
|
|
|
|
|
[[sponsors.gold.sponsors]]
|
2023-12-13 02:10:49 +00:00
|
|
|
|
name = "RWF2"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
url = "https://rwf2.org"
|
|
|
|
|
img = "rwf2.gif"
|
2023-12-13 02:10:49 +00:00
|
|
|
|
blurb = "Rocket Web Framework Foundation"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
width = "55px"
|
|
|
|
|
|
|
|
|
|
[sponsors.bronze]
|
|
|
|
|
name = "🤎 Bronze"
|
|
|
|
|
tag = "$50/month"
|
2023-12-13 02:10:49 +00:00
|
|
|
|
color = "#c7a483"
|
2023-11-22 20:38:53 +00:00
|
|
|
|
height = "30px"
|
2023-12-13 02:10:49 +00:00
|
|
|
|
|
|
|
|
|
[[sponsors.bronze.sponsors]]
|
|
|
|
|
name = "1Password"
|
|
|
|
|
url = "https://1password.com"
|
|
|
|
|
img = "1password.svg"
|
|
|
|
|
blurb = "The world’s most-loved password manager"
|
|
|
|
|
width = "30px"
|