diff --git a/src/main.rs b/src/main.rs index 9325a8b..c587776 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,10 +8,6 @@ use std::path::{ PathBuf, Path }; // serve file with Content-Type based on name use rocket::fs::{ NamedFile, relative }; -// Set MIME-Types, Accept Header for Response -use rocket::http::{ Accept, MediaType }; -use rocket::http::ContentType; - // Equivalent to main() #[rocket::main] // enable async main() async fn main() -> Result<(), rocket::Error> { @@ -26,7 +22,14 @@ async fn main() -> Result<(), rocket::Error> { // State Rocket => Finalized App ready to launch // check before launching // catch errors - .mount("/", routes![ index, fileserver, experiments, perma, greentech ]) + .mount("/", routes![ index, fileserver, experiments, perma, greentech, spider, learn ]) + .mount("/experiments", routes! [ oil, flower, candy ]) + .mount("/permaculture", routes! [ permapp, greenlab, about_perma ]) + .mount("/greentech", routes! [ automation, iot, diy ]) + .mount("/spider", routes! [ spiderpi, join ]) + .mount("/learn", routes! [ about, partners, meet, blog, code ]) + .mount("/policies", routes! [ policies_info, privacy ]) + .ignite().await? // State Rocket => Running App @@ -62,6 +65,106 @@ async fn greentech() -> Option { NamedFile::open("templates/greentech.html").await.ok() } +#[get("/spider")] +async fn spider() -> Option { + NamedFile::open("templates/spider.html").await.ok() +} + +#[get("/learn")] +async fn learn() -> Option { + NamedFile::open("templates/learn.html").await.ok() +} + +#[get("/oil")] +async fn oil() -> Option { + NamedFile::open("templates/oils.html").await.ok() +} + +#[get("/flower")] +async fn flower() -> Option { + NamedFile::open("templates/flower.html").await.ok() +} + +#[get("/candy")] +async fn candy() -> Option { + NamedFile::open("templates/edibles.html").await.ok() +} + +#[get("/permApp")] +async fn permapp() -> Option { + NamedFile::open("templates/permapp.html").await.ok() +} + +#[get("/greenlab")] +async fn greenlab() -> Option { + NamedFile::open("templates/greenlab.html").await.ok() +} + +#[get("/about")] +async fn about_perma() -> Option { + NamedFile::open("templates/whatsthat.html").await.ok() +} + +#[get("/automation")] +async fn automation() -> Option { + NamedFile::open("templates/automation.html").await.ok() +} + +#[get("/DiY")] +async fn diy() -> Option { + NamedFile::open("templates/diy.html").await.ok() +} + +#[get("/IoT")] +async fn iot() -> Option { + NamedFile::open("templates/iot.html").await.ok() +} + +#[get("/spiderPi")] +async fn spiderpi() -> Option { + NamedFile::open("templates/spiderpi.html").await.ok() +} + +#[get("/join")] +async fn join() -> Option { + NamedFile::open("templates/join.html").await.ok() +} + +#[get("/about")] +async fn about() -> Option { + NamedFile::open("templates/whoweare.html").await.ok() +} + +#[get("/partners")] +async fn partners() -> Option { + NamedFile::open("templates/partners.html").await.ok() +} + +#[get("/contact")] +async fn meet() -> Option { + NamedFile::open("templates/meet.html").await.ok() +} + +#[get("/blog")] +async fn blog() -> Option { + NamedFile::open("templates/blog.html").await.ok() +} + +#[get("/code")] +async fn code() -> Option { + NamedFile::open("templates/code.html").await.ok() +} + +#[get("/")] +async fn policies_info() -> Option { + NamedFile::open("templates/policies.html").await.ok() +} + +#[get("/privacy")] +async fn privacy() -> Option { + NamedFile::open("templates/privacy-policy.html").await.ok() +} + // Serve static files from / // Match against multiple segments @@ -73,13 +176,8 @@ async fn greentech() -> Option { #[route(GET, uri= "/")] async fn fileserver(path: PathBuf) -> Option { // PathBuf = Heapstring, growable // set path to static files - let mut path = Path::new(relative!("templates/assets")).join(path); // Path = stack string, fixed size + let path = Path::new(relative!("templates/assets")).join(path); // Path = stack string, fixed size // path accessible from / - - // Note: How to serve fontawesome ? - if path.ends_with("all.css") { - println!("Can not load fontawesome icons at: {:?}", path); - } // Open file at path NamedFile::open(path).await.ok() } \ No newline at end of file diff --git a/templates/assets/components/experiments-content.html b/templates/assets/components/experiments-content.html index 514d5cb..5470cf8 100644 --- a/templates/assets/components/experiments-content.html +++ b/templates/assets/components/experiments-content.html @@ -4,8 +4,8 @@

Experiments

Each of our CBD products helps you and us understand our planet.

- - + +
@@ -20,14 +20,14 @@
@@ -53,14 +53,14 @@
- - - - + + + +
@@ -83,14 +83,14 @@
- - - - + + + +
diff --git a/templates/assets/components/footer.html b/templates/assets/components/footer.html index d60e662..9c5030b 100644 --- a/templates/assets/components/footer.html +++ b/templates/assets/components/footer.html @@ -2,7 +2,6 @@