feat(highscores): add SQLite Axum service
Add a small standalone Axum service for the shared anonymous top-ten table. SQLite keeps the deployment self-contained, while one transaction inserts a validated name and score and removes entries below the canonical top ten. Expose a health endpoint and same-origin API, with an nginx proxy block and run instructions beside the service. Keep the service outside the game crate so native gameplay persistence remains unchanged. Test Plan: - `cargo test --manifest-path highscore-server/Cargo.toml` -- passed (3 tests) - `cargo clippy --manifest-path highscore-server/Cargo.toml --all-targets --all-features -- -D warnings` -- passed - `cargo +nightly fmt --manifest-path highscore-server/Cargo.toml -- --check` -- passed - Live executable health, POST, and GET smoke test -- passed - `git diff --cached --check` -- passed
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Add this block inside the nginx server block that serves the game.
|
||||
location /api/highscores {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
# Optional health check for local monitoring.
|
||||
location = /healthz {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
Reference in New Issue
Block a user