Open ThePrimeagen opened 1 year ago
... Exploring Leptos Server Functions and Leptos Router and Cloudflare routing ... ... probably a dick joke ...
Love to see you get into it, especially the parts I wrote some of. I think you're going to end up with config based routing, because file based is not at all implemented.
This will render your app and collect all the routes defined in the route https://docs.rs/leptos_axum/latest/leptos_axum/fn.generate_route_list.html
Then they can be fed into the LeptosRoutes trait on your axum/actix router like so: https://docs.rs/leptos_axum/latest/leptos_axum/trait.LeptosRoutes.html
let routes = generate_route_list(|cx| view! { cx, <App/> }).await;
let app = Router::new()
.route("/api/*fn_name", post(leptos_axum::handle_server_fns))
.leptos_routes(leptos_options.clone(), routes, |cx| view! { cx, <App/> } )
.fallback(file_and_error_handler)
Looking forward to it
Stream 2023/01/31
Talked to Greg (Leptos man) today
We have 3 real options we can pursue.
2 and 3 can be mixed but it does seem like this is the best way we can do things. So that means i'll have to review how this works on stream.