Optional backend for persisting player statistics across devices
https://pong.deewhy.ovh
Called when a user logs in. Returns the current profile or creates a new one.
# Request
POST /api/user/Davide
# Response (200 OK)
{
"username": "Davide",
"total_wins": 12,
"total_losses": 5,
"total_matches": 17,
"level": 3
}
Called when a match ends. Increments win/loss counters and recalculates level.
# Request
POST /api/user/Davide/update
Content-Type: application/json
{
"win": true
}
# Response (200 OK)
{
"status": "updated",
"username": "Davide",
"total_wins": 13,
"level": 3
}
{
"username": "string (2-18 chars, alphanumeric)",
"total_wins": "integer ≥ 0",
"total_losses": "integer ≥ 0",
"total_matches": "integer = wins + losses",
"level": "integer ≥ 1 (derived from total_matches)"
}
Level calculation: level = 1 + floor(total_matches / 10)
400 Bad Request — Invalid username format429 Too Many Requests — Rate limit exceeded (60 req/min per IP)5xx Server Error — Temporary failure; client should retry with exponential backoffAll errors return JSON: {"error": "message"}
timeout=4 seconds on all requests2 ≤ len ≤ 18, alphanumeric + underscore only