diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index f97f600..042465d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,27 @@ #![feature(proc_macro_hygiene, decl_macro)] -use rocket::{get, http::RawStr, routes, response::NamedFile}; +use askama::Template; +use rocket::{ + get, + http::RawStr, + routes, + response::{ + NamedFile, + content::Html, + }, +}; use std::path::PathBuf; +#[derive(Template)] +#[template(path = "index.html")] +struct IndexTemplate<'a> { + year: &'a str, +} + #[get("/")] -fn index() -> &'static str { - "Holahey, Jävlar!" +fn index<'a>() -> Html<String> { + let t = IndexTemplate { year: "2019" }; + Html(t.render().unwrap()) } #[get("/<file>", rank = 99)] |