Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
//! KnightVerse Backend - Main Entry Point
//!
//! This is the unified entry point for the KnightVerse backend service.
//! It initializes the API server with all configured routes and middleware.

use api::server;
mod telemetry;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
server::main().await
let tracer_provider = telemetry::init_telemetry()
.expect("failed to initialize telemetry");

// ... existing DB pool / redis pool / app state setup stays exactly as is ...

let server = HttpServer::new(move || {
App::new()
.wrap(tracing_actix_web::TracingLogger::default()) // <-- add this, before/around other middleware
// ... existing .app_data(...), .service(...), .route(...) calls unchanged ...
})
.bind(("0.0.0.0", 8080))? // match the existing bind address/port
.run();

server.await?;

telemetry::shutdown_telemetry(tracer_provider);
Ok(())
}
1 change: 1 addition & 0 deletions backend/src/socket/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub fn join_room(room_id: &str, player_id: &str, player_name: Option<String>) ->
}

// Send a move
#[tracing::instrument(fields(room_id = %room_id, player_id = %player_id))]
pub fn send_move(room_id: &str, player_id: &str, move_notation: &str) -> Result<ServerMessage, String> {
let mut state = GAME_STATE.lock().unwrap();

Expand Down
Loading