leptos/examples/hackernews
2022-12-06 19:22:29 -05:00
..
src Fix Hackernews CSS 2022-12-06 19:22:29 -05:00
Cargo.toml Fix name of Wasm export 2022-12-06 18:18:46 -05:00
index.html Updated hacker news example to new SFA format and added a README 2022-11-14 09:03:44 -08:00
LICENSE Updated hacker news example to new SFA format and added a README 2022-11-14 09:03:44 -08:00
README.md Copy edited and added Trunk install instructions 2022-11-29 20:00:09 -05:00
style.css Updated hacker news example to new SFA format and added a README 2022-11-14 09:03:44 -08:00

Leptos Hacker News Example

This example creates a basic clone of the Hacker News site. It showcases Leptoss ability to create both a client-side rendered app, and a server side rendered app with hydration, in a single repository. It uses Actix as its backend.

Client Side Rendering

To run it as a Client Side App, you can issue trunk serve --open in the root. This will build the entire app into one CSR bundle.

If you don't have trunk installed, click here for install instructions.

Server Side Rendering With Hydration

To run it as a server side app with hydration, first you should run

wasm-pack build --target=web --no-default-features --features=hydrate

to generate the WebAssembly to hydrate the HTML that is generated on the server.

Then run the server with cargo run to serve the server side rendered HTML and the WASM bundle for hydration.

cargo run --no-default-features --features=ssr

Note that if your hydration code changes, you will have to rerun the wasm-pack command above This should be temporary, and vastly improve once cargo-leptos becomes ready for prime time!