-mod db;
-
-#[derive(Template)]
-#[template(path = "home.html")]
-struct HomeTemplate {
- recipes: Vec<db::Recipe>
-}
-
-#[derive(Template)]
-#[template(path = "view_recipe.html")]
-struct ViewRecipeTemplate {
- recipes: Vec<db::Recipe>,
- current_recipe: db::Recipe
-}
-
-#[derive(Deserialize)]
-pub struct Request {
- m: Option<String>
-}
-
-#[get("/")]
-async fn home_page(req: HttpRequest) -> impl Responder {
- HomeTemplate { recipes: vec![ db::Recipe { title: String::from("Saumon en croûte feuilletée"), id: 1 }, db::Recipe { title: String::from("Croissant au jambon"), id: 2 } ] }
-}
-
-#[get("/recipe/view/{id}")]
-async fn view_page(req: HttpRequest, path: web::Path<(i32,)>) -> impl Responder {
- ViewRecipeTemplate { recipes: vec![ db::Recipe { title: String::from("Saumon en croûte feuilletée"), id: 1 }, db::Recipe { title: String::from("Croissant au jambon"), id: 2 } ], current_recipe: db::Recipe { title: String::from("Saumon en croûte feuilletée"), id: 1 } }
-}
-
-#[derive(Debug, Deserialize)]
-struct Config {
- port: u16
-}
-
-fn get_exe_name() -> String {
- let first_arg = std::env::args().nth(0).unwrap();
- let sep: &[_] = &['\\', '/'];
- first_arg[first_arg.rfind(sep).unwrap()+1..].to_string()
-}