Implement basic templating

This commit is contained in:
Elnu 2023-05-31 12:44:58 -07:00
parent 234458e11c
commit 1cf099845b
5 changed files with 1317 additions and 85 deletions

View file

@ -1,11 +1,19 @@
#[macro_use] extern crate rocket;
use rocket_dyn_templates::{Template, context};
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
fn index() -> Template {
Template::render("index", context! {
challenge: 114,
})
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![index])
let config = rocket::Config::figment()
.merge(("port", 1313));
rocket::custom(config)
.mount("/", routes![index])
.attach(Template::fairing())
}