pub mod admin; pub mod contexts; pub mod controllers; pub mod misc; pub mod models; mod schema; #[macro_use] extern crate rocket; #[macro_use] extern crate diesel; use comrak::{markdown_to_html, Options}; use controllers::posts; use dotenv::dotenv; use rocket::fs::{FileServer, NamedFile}; use rocket::response::content::RawXml; use rocket::Request; use rocket_dyn_templates::Template; use std::path::Path; use std::vec::Vec; #[get("/?")] fn index(page: Option) -> Template { let page: u64 = page.unwrap_or(1); let (posts, n_posts) = posts::get_posts(Some(page)); let context = contexts::PageOfPosts::new(posts, page, n_posts); Template::render("index", context) } #[get("/feed.xml")] fn rss_feed() -> RawXml