aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/main.rs b/src/main.rs
index 1ee6011..5c858aa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,31 +17,8 @@
*/
#![feature(proc_macro_hygiene, decl_macro)]
-use askama::Template;
-use rocket::{
- get,
- http::RawStr,
- routes,
- response::NamedFile,
-};
-use std::path::PathBuf;
-
-#[derive(Template)]
-#[template(path = "index.html")]
-struct IndexTemplate<'a> {
- year: &'a str,
-}
-
-#[get("/")]
-fn index<'a>() -> IndexTemplate<'static> {
- IndexTemplate { year: "2019" }
-}
-
-#[get("/<file>", rank = 99)]
-fn public_file(file: &RawStr) -> Option<NamedFile> {
- NamedFile::open(PathBuf::from("public/").join(file.as_str())).ok()
-}
-
fn main() {
- rocket::ignite().mount("/", routes![index, public_file]).launch();
+ rocket::ignite()
+ .mount("/", rocket_contrib::serve::StaticFiles::from("./public"))
+ .launch();
}