aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--public/favicon.icobin0 -> 7945 bytes
-rw-r--r--src/main.rs10
2 files changed, 8 insertions, 2 deletions
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..3030902
--- /dev/null
+++ b/public/favicon.ico
Binary files differ
diff --git a/src/main.rs b/src/main.rs
index e283b21..f97f600 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,12 +1,18 @@
#![feature(proc_macro_hygiene, decl_macro)]
-use rocket::{get, routes};
+use rocket::{get, http::RawStr, routes, response::NamedFile};
+use std::path::PathBuf;
#[get("/")]
fn index() -> &'static str {
"Holahey, Jävlar!"
}
+#[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]).launch();
+ rocket::ignite().mount("/", routes![index, public_file]).launch();
}