1pub mod errors;
2pub mod javascript;
3pub mod view;
4
5#[cfg(feature = "sessions")]
6pub mod session;
7
8#[cfg(feature = "sessions")]
9pub use session::Session;
10
11#[cfg(feature = "turbo-streams")]
12pub mod turbo;
13
14#[cfg(feature = "middleware")]
15pub mod middleware;
16
17static SITE_ROOT: std::sync::Mutex<Option<String>> = std::sync::Mutex::new(None);
18
19pub fn set_app_root(root: impl Into<String>) {
21 let root: String = root.into();
22 let mut lock = SITE_ROOT.lock().unwrap();
23 *lock = Some(root);
24}
25
26pub fn app_root() -> String {
28 let lock = SITE_ROOT.lock().unwrap();
29 match lock.as_deref() {
30 Some(r) => r.to_owned(),
31 None => "/".to_owned(),
32 }
33}