This repository is a proof of concept of:
- Serving a yew frontend application from a rocket backend
- Using the yew-sse library to send messages and receive them from several connected clients.
This example is not meant to be minimal. Rather, it's meant to be fun, and so it uses:
- The cargo xtask pattern to distribute and serve the frontend application from the backend.
- trunk to perform the "distribution" step of the frontend
- clap for ergonomic CLI definition
- color-eyre for nice, colored errors ✨
- duct, for easy scripting in Rust
What it does not demonstrate though, is the vastness of my skills at CSS 😛.
You'll need Rust installed, with the wasm32-unknown-unknown
target available, as well as the trunk tool.
To install trunk
, just run:
cargo install trunk
To install the wasm32-unknown-unknown
target:
rustup target add wasm32-unknown-unknown
From the repository's root directory, run:
cargo xtask run
(add the --release
flag to build everything in --release
mode)
After the build, once rocket is started, open http://127.0.0.1:8000 in your browser to use the yew application. Open several times the same page to exchange messages! Very convenient 😅