Repository navigation
Loco + Leptos SSR Showcase #1748
JonasCir
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi there,
I stumbled over leptos_axum which provides an easy way to setup Leptos SSR for Axum. I wondered how much work it would be to bring this to
locoand it turns out, it is absolutely feasible. Let me show you:loco new-> App name:loco_leptos_ssr-> lightweight-service to keep it simplecargo install --locked cargo-leptos-> official Leptos toolingrustup target add wasm32-unknown-unknowngit clone git@github.com:loco-rs/loco.git-> we need a minimal patch for locogit apply filename.patch.loco_leptos_ssrwith this git diff gist. What I did here was to go through Leptos' official Axum template (licensed under "The Unlicense") and basically applying everything what they did there to the fresh project. Biggest part of the diff is due to them using theCargo.tomlfor config and setting up dependencies/features/targets. The actual code changes are small. I also had to change the name of the bin (removed-clias I was hitting a bug withcargo-leptosw.r.t. name normalization).favicon.icointopublicand runcargo leptos watch -- startsrc/leptos_ssr/app.rsallows to seamlessly call server functions unlocking the true power of both projects :)What do you think? :)
All reactions