mirror of https://github.com/rwf2/Rocket.git
Reorganize templating sections in responses guide.
This commit is contained in:
parent
3f2e724b23
commit
4d72a92a9c
|
@ -250,7 +250,6 @@ to stream from a local Unix stream, we might write:
|
|||
fn stream() -> io::Result<Stream<UnixStream>> {
|
||||
UnixStream::connect("/path/to/my/socket").map(|s| Stream::from(s))
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
[`rocket_contrib`]: @api/rocket_contrib/
|
||||
|
@ -286,7 +285,7 @@ The [JSON example on GitHub] provides further illustration.
|
|||
[`serde`]: https://docs.serde.rs/serde/
|
||||
[JSON example on GitHub]: @example/json
|
||||
|
||||
### Templates
|
||||
## Templates
|
||||
|
||||
Rocket includes built-in templating support that works largely through a
|
||||
[`Template`] responder in `rocket_contrib`. To render a template named "index",
|
||||
|
@ -314,8 +313,8 @@ fairings. To attach the template fairing, simply call
|
|||
```rust
|
||||
fn main() {
|
||||
rocket::ignite()
|
||||
.mount("/", routes![...])
|
||||
.attach(Template::fairing());
|
||||
.mount("/", routes![...])
|
||||
.attach(Template::fairing());
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -331,6 +330,8 @@ used.
|
|||
the name `"index"` in templates, i.e, `{% extends "index" %}` or `{% extends
|
||||
"base" %}` for `base.html.tera`.
|
||||
|
||||
### Live Reloading
|
||||
|
||||
When your application is compiled in `debug` mode (without the `--release` flag
|
||||
passed to `cargo`), templates are automatically reloaded when they are modified
|
||||
on supported platforms. This means that you don't need to rebuild your
|
||||
|
|
Loading…
Reference in New Issue