Backend - Miol-Mor/battle-game GitHub Wiki

Backend is written in the rust actix framework

How to run?

Follow this guide to install required version of rust

Run backend in test mode:

cargo run --manifest-path backend/Cargo.toml

Run backend in release mode:

cargo run --manifest-path backend/Cargo.toml --release

To change logger pass log level with environment variable RUST_LOG to cargo. Default value is error. Available variants are:

  • trace
  • debug
  • info
  • warn
  • error

Example: RUST_LOG=debug cargo run --manifest-path backend/Cargo.toml

How to test

Unit tests

Run tests via command

cargo test --manifest-path backend/Cargo.toml

Manually

Test it manually with websocket client. This one for example

You have to connect to ws://localhost:8088/ws/ (for example websocat ws://localhost:8088/ws/)

API

GET: /ws/

Connect you to websocket