Firstly, we open two terminals.
One for Server.
One for client.
- Update dependencies as recorded in the local lock file
cargo update
- Update rust toolchain installer
rustup update
- Use Rust Nightly
rustup override set nightly
- Download MongoDB (Followed the MongoDB offical website)
https://www.mongodb.com/docs/manual/administration/install-community/
- Set up Server and open the MongoDB shell
mongod
mongo
- Initialized the Database If we already have ServerDB, then
use ServerDB
db.dropDatabase()
else
use ServerDB
db.createCollection("users")
db.users.createIndex({"username": 1}, {unique: true})
db.createCollection("scores")
db.scores.createIndex({"username": 1}, {unique: true})
- Run the Server
cargo run
- Install Trunk (a WASM web application bundler for Rust)
cargo install trunk
- Install the wasm-bindgen Command Line Interface
cargo install wasm-bindgen-cli
- Run the client with specific port
trunk serve --port XXXX
- Go the the website and start application
localhost:XXXX