🌌 SkyDB API

統一天文資料 API - 為 AR Stars 提供資料服務

75
恆星
10
行星
14
衛星
10
深空天體
6
人造衛星
19
地標

📡 API 端點

搜尋索引
/index.json

包含所有天體的 ID、名稱和類型,用於搜尋功能(~9KB)

查看資料
目錄列表
/catalog.json

包含基本資料、縮圖和摘要,用於列表顯示(~48KB)

查看資料
詳細資料
/details/{category}/{id}.json

完整的天體資料,按需載入(2-5KB each)

範例:天狼星

💻 使用範例

// 載入索引和目錄
const index = await fetch('/index.json').then(r => r.json());
const catalog = await fetch('/catalog.json').then(r => r.json());

// 搜尋天體
function search(query) {
  return index.objects.filter(obj => 
    obj.name.toLowerCase().includes(query) ||
    obj.name_zh?.includes(query)
  );
}

// 載入詳細資料
async function getDetails(type, id) {
  const category = getCategoryFolder(type);
  const url = `/details/${category}/${id}.json`;
  return await fetch(url).then(r => r.json());
}

🚀 特色

📊 資料結構

v2.0 架構採用三層載入設計: