Rocket: Use fairings for routes of sub-files

Instead of adding all routes manually in the Launch function for Rocket,
implement fairings for all the different files that adds the routing to
the rocket in a self-contained manner.
This commit is contained in:
trotFunky 2024-07-27 21:22:34 +01:00
parent 120472354c
commit 222acbb4f8
6 changed files with 28 additions and 10 deletions

View file

@ -210,3 +210,9 @@ pub async fn create_week(week: u8, mut db: Connection<Db>, cookies: &CookieJar<'
}
}
}
pub fn stage() -> AdHoc {
AdHoc::on_ignite("Week stage", |rocket| async {
rocket.mount("/", routes![week, create_week, update_week, set_last_week])
})
}