Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4d72a92a9c0f1dad1fc2bf3b5ab7d51a28966713
parent 3f2e724b238002a642b21adba1533a5baab1f8e8
Author: Sergio Benitez <sb@sergio.bz>
Date:   Sat, 27 Oct 2018 18:27:24 -0700

Reorganize templating sections in responses guide.

Diffstat:
Msite/guide/5-responses.md | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/site/guide/5-responses.md b/site/guide/5-responses.md @@ -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