fix: use Path instead of relative! macro

This commit is contained in:
Araozu 2024-10-26 23:03:05 -05:00
parent 78f8c5bead
commit ae2f654eeb

View File

@ -1,10 +1,13 @@
#[macro_use] #[macro_use]
extern crate rocket; extern crate rocket;
use core::time; use core::time;
use std::time::{SystemTime, UNIX_EPOCH}; use std::{
path::Path,
time::{SystemTime, UNIX_EPOCH},
};
use maud::{html, Markup, DOCTYPE}; use maud::{html, Markup, DOCTYPE};
use rocket::fs::{relative, FileServer}; use rocket::fs::FileServer;
#[get("/")] #[get("/")]
fn index() -> Markup { fn index() -> Markup {
@ -135,9 +138,11 @@ fn skeleton(children: Markup) -> Markup {
#[launch] #[launch]
fn rocket() -> _ { fn rocket() -> _ {
std::thread::sleep(time::Duration::from_secs(360)); std::thread::sleep(time::Duration::from_secs(30));
let static_files_path = Path::new("./public");
rocket::build() rocket::build()
.mount("/", routes![index]) .mount("/", routes![index])
.mount("/public", FileServer::from(relative!("public"))) .mount("/public", FileServer::from(static_files_path))
} }