Skip to content

Commit

Permalink
Probably need that
Browse files Browse the repository at this point in the history
  • Loading branch information
richo committed Dec 18, 2019
1 parent c0a36dd commit d60c15d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/web/routes/index.rs
@@ -0,0 +1,26 @@
use crate::web::db::DbConn;
use crate::web::auth::WebUser;
use crate::web::context::Context;

use rocket::request::FlashMessage;
use rocket_contrib::templates::Template;

#[get("/")]
pub fn index(user: Option<WebUser>, conn: DbConn, flash: Option<FlashMessage<'_, '_>>) -> Template {
let context = Context::other()
.set_user(user)
.flash(flash.map(|ref msg| (msg.name().into(), msg.msg().into())));
Template::render("index", context)
}

#[get("/privacy")]
pub fn privacy() -> Template {
let context = Context::other();
Template::render("privacy", context)
}

#[catch(404)]
pub fn not_found() -> Template {
let context = Context::other();
Template::render("404", context)
}

0 comments on commit d60c15d

Please sign in to comment.