多应用排行榜
每个应用独立 API Key,只需传入名字和分数即可接入
输入 API Key 连接应用
极简接入
注册应用获取 API Key,前端只需传名字 + 分数
最高分模式
同一玩家只保留最高分,自动去重排序
多应用隔离
每个 API Key 对应独立排行榜,互不干扰
接入示例 — 3 行代码搞定
// 提交分数(name + score,就这两个字段)
await fetch('/scores', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Api-Key': API_KEY },
body: JSON.stringify({ name: 'Alice', score: 9800 })
})
// 获取排行榜
const board = await fetch('/leaderboard?limit=10', {
headers: { 'X-Api-Key': API_KEY }
}).then(r => r.json())