add fileserver

This commit is contained in:
philipp 2023-04-05 19:24:02 +02:00
parent 727e6257d2
commit 0789095704

View File

@ -1,6 +1,8 @@
use chrono::{Datelike, Duration, Local, NaiveDate}; use chrono::{Datelike, Duration, Local, NaiveDate};
use rocket::{ use rocket::{
catch, catchers, get, catch, catchers,
fs::FileServer,
get,
request::FlashMessage, request::FlashMessage,
response::{Flash, Redirect}, response::{Flash, Redirect},
routes, Build, Rocket, State, routes, Build, Rocket, State,
@ -75,6 +77,7 @@ pub fn start(db: SqlitePool) -> Rocket<Build> {
.mount("/auth", auth::routes()) .mount("/auth", auth::routes())
.mount("/cox", cox::routes()) .mount("/cox", cox::routes())
.mount("/admin", admin::routes()) .mount("/admin", admin::routes())
.mount("/public", FileServer::from("static/"))
.register("/", catchers![unauthorized_error]) .register("/", catchers![unauthorized_error])
.attach(Template::fairing()) .attach(Template::fairing())
} }