ThePrimeagen / primestack

136 stars 3 forks source link

primestack: Routes #3

Open ThePrimeagen opened 1 year ago

ThePrimeagen commented 1 year ago

Stream 2023/01/31

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.

ThePrimeagen commented 1 year ago

Stream 2023/02/01 (Upcoming)

... Exploring Leptos Server Functions and Leptos Router and Cloudflare routing ... ... probably a dick joke ...

benwis commented 1 year ago

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