main: Serve static files from /static path

Static files served with FileServer have a low priority : all other possible routes
a this root will be checked first, before they get returned.
As we have a lot of routes at the root, they will be hit a lot before we get
to the static files.

Move the static files to a dedicated path to reduce those internal redirections,
update the paths in the HTML and add one for the favicon so it continues to work.
This commit is contained in:
trotFunky 2024-07-27 21:47:26 +01:00
parent 222acbb4f8
commit 36b2e61e26
2 changed files with 5 additions and 4 deletions

View file

@ -35,7 +35,7 @@ async fn index(mut db: Connection<Db>) -> Redirect {
#[launch]
fn rocket() -> _ {
rocket::build()
.mount("/", FileServer::from(relative!("static_files")))
.mount("/static/", FileServer::from(relative!("static_files")))
.attach(auth::stage())
.attach(week::stage())
.attach(truth::stage())