leptos/examples/hackernews-axum
2022-11-16 17:26:45 -08:00
..
src Fix CSS imports, is a bit clunky though 2022-11-16 17:26:45 -08:00
static Fix CSS imports, is a bit clunky though 2022-11-16 17:26:45 -08:00
Cargo.toml Commited almost working example 2022-11-16 08:13:49 -08:00
index.html Fix CSS imports, is a bit clunky though 2022-11-16 17:26:45 -08:00
LICENSE Add hackernews-axum example 2022-11-15 14:08:09 -08:00
README.md Add hackernews-axum example 2022-11-15 14:08:09 -08:00

Leptos Hacker News Example with Axum

This example creates a basic clone of the Hacker News site. It showcases Leptos' ability to create both a client-side rendered app, and a server side rendered app with hydration, in a single repository. This repo differs from the main Hacker News example by using Axum as it's server.

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 CRS bundle

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 provide hydration features for 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!