summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAshelyn Rose <git@ashen.earth>2025-04-12 16:52:11 -0600
committerAshelyn Rose <git@ashen.earth>2025-04-12 16:52:16 -0600
commite487e052b3cfcf90f6b831052e30323d3e744526 (patch)
tree1471ad27e0c88e0cae121292a4f4ff6b43c2329f /src/main.rs
parente66c23f2f4fd3783364aaa15f07f8a51aaf51e3f (diff)
WIP: working on getting data into components
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
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