Rusty Connect 4 is a full-stack project written completely in Rust. It uses:
rocket
on the backendyew
for creating front-end webapps withWebAssembly
(yew is a great component-based framework!)yew-router
for routingstdweb
to provide Rust bindings for Web APIs
The backend is only used for requests and saving your progress. You can still play the game with just the frontend.
The frontend is built using cargo-web, which can be installed with the following command.
cargo install cargo-web
The backend uses MongoDB for storing game history. Instructions for how to install MongoDB can be found here.
Rocket requires the latest version of Rust nightly (see here). From the base directory of the project, run:
rustup override set nightly
The project can be built and ran from by executing the following commands from the base directory of the project.
To compile the frontend and generate the static files for the webpage:
(cd frontend && cargo web deploy)
To build and run the backend:
cargo run -p backend
The game should now be up and running and can be accessed by going to localhost:8000 in any web browser.