diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index a9e3f1d..13512c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,13 @@ -pub mod data; - -use tokio::signal; #[cfg(feature = "ssr")] #[tokio::main] async fn main() { - use axum::Router; + use axum::{response::Redirect, routing::get, Router}; use leptos::logging::log; use leptos::prelude::*; use leptos_axum::{generate_route_list, LeptosRoutes}; use stormscribe::components::app::*; + // use stormscribe::data::content::ContentController; let conf = get_configuration(None).unwrap(); let addr = conf.leptos_options.site_addr; @@ -17,8 +15,16 @@ async fn main() { // Generate the list of routes in your Leptos App let routes = generate_route_list(App); + // let data_dir = std::path::Path::join(&std::env::current_dir().unwrap(), "data"); + // let content_controller = ContentController::init(data_dir).unwrap(); + let app = Router::new() - .leptos_routes(&leptos_options, routes, { + .route("/", get(|| async { + Redirect::temporary("/~/") + })) + .leptos_routes_with_context(&leptos_options, routes, move || { + // provide_context(content_controller.clone()); + }, { let leptos_options = leptos_options.clone(); move || shell(leptos_options.clone()) }) @@ -37,6 +43,7 @@ async fn main() { #[cfg(feature = "ssr")] async fn shutdown_signal() { + use tokio::signal; let ctrl_c = async { signal::ctrl_c() .await |