diff --git a/peach-web/src/main.rs b/peach-web/src/main.rs index 1d073e6..ab1941f 100644 --- a/peach-web/src/main.rs +++ b/peach-web/src/main.rs @@ -30,15 +30,15 @@ pub mod routes; mod tests; pub mod utils; -use log::{info, error}; +use log::{error, info}; use std::process; -use rocket::{catchers, routes, Rocket, Build, fs::FileServer}; +use rocket::{catchers, fs::FileServer, routes, Build, Rocket}; use rocket_dyn_templates::Template; use crate::routes::authentication::*; -use crate::routes::device::*; use crate::routes::catchers::*; +use crate::routes::device::*; use crate::routes::index::*; use crate::routes::ping::*; use crate::routes::scuttlebutt::*; @@ -47,12 +47,27 @@ use crate::routes::settings::admin::*; use crate::routes::settings::dns::*; use crate::routes::settings::network::*; - pub type BoxError = Box; /// Create rocket instance & mount all routes. fn init_rocket() -> Rocket { rocket::build() + .mount( + "/scuttlebutt", + routes![ + peers, // WEB ROUTE + friends, // WEB ROUTE + follows, // WEB ROUTE + followers, // WEB ROUTE + blocks, // WEB ROUTE + profile, // WEB ROUTE + private, // WEB ROUTE + follow, // WEB ROUTE + unfollow, // WEB ROUTE + block, // WEB ROUTE + publish, // WEB ROUTE + ], + ) .mount( "/", routes![ @@ -68,13 +83,10 @@ fn init_rocket() -> Rocket { login, // WEB ROUTE login_post, // WEB ROUTE logout, // WEB ROUTE - messages, // WEB ROUTE network_home, // WEB ROUTE network_add_ssid, // WEB ROUTE network_add_wifi, // WEB ROUTE network_detail, // WEB ROUTE - peers, // WEB ROUTE - profile, // WEB ROUTE reboot_cmd, // WEB ROUTE shutdown_cmd, // WEB ROUTE shutdown_menu, // WEB ROUTE @@ -130,7 +142,6 @@ fn init_rocket() -> Rocket { /// Launch the peach-web rocket server. #[rocket::main] async fn main() { - // initialize logger env_logger::init(); @@ -140,7 +151,7 @@ async fn main() { // launch rocket info!("Launching Rocket"); - if let Err(e) = rocket.launch().await { + if let Err(e) = rocket.launch().await { error!("Error in Rocket application: {}", e); process::exit(1); }