Add /json endpoint #13

Merged
SnO2WMaN merged 3 commits from feat/json-endpoint into main 2026-06-01 04:49:32 -04:00
SnO2WMaN commented 2026-06-01 04:19:48 -04:00 (Migrated from github.com)

概要

/xml と同等のデータを JSON で返す /json エンドポイントを追加しました。

変更点

  • /xml のクエリ解決ロジックを resolveQuery 関数に抽出して共通化
  • /json エンドポイントを追加(resolveQuery の結果を c.json() で返却)
  • エラーハンドリング(No query / Invalid query / Cannot fallback / Cannot fetch otoDB data)とステータスコードは /xml と共通

使い方

GET /json?q=<URL or ID>

レスポンスは /xml の <data> 直下と同じ構造を JSON で返します。

🤖 Generated with Claude Code

## 概要 `/xml` と同等のデータを JSON で返す `/json` エンドポイントを追加しました。 ## 変更点 - `/xml` のクエリ解決ロジックを `resolveQuery` 関数に抽出して共通化 - `/json` エンドポイントを追加(`resolveQuery` の結果を `c.json()` で返却) - エラーハンドリング(`No query` / `Invalid query` / `Cannot fallback` / `Cannot fetch otoDB data`)とステータスコードは `/xml` と共通 ## 使い方 ``` GET /json?q=<URL or ID> ``` レスポンスは `/xml` の `<data>` 直下と同じ構造を JSON で返します。 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cloudflare-workers-and-pages[bot] commented 2026-06-01 04:19:53 -04:00 (Migrated from github.com)

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
roxy 61f1dbcb Commit Preview URL

Branch Preview URL
Jun 01 2026, 08:45 AM
## Deploying with &nbsp;<a href="https://workers.dev"><img alt="Cloudflare Workers" src="https://workers.cloudflare.com/logo.svg" width="16"></a> &nbsp;Cloudflare Workers The latest updates on your project. Learn more about [integrating Git with Workers](https://developers.cloudflare.com/workers/ci-cd/builds/git-integration/). | Status | Name | Latest Commit | Preview URL | Updated (UTC) | | -|-|-|-|-| | ✅ Deployment successful! <br>[View logs](https://dash.cloudflare.com/?to=/0079923690d96ce7b9bc0ec87055c74b/workers/services/view/roxy/production/builds/73a1a8c7-5717-49d7-8ed2-6496c1a5c884) | roxy | 61f1dbcb | <a href='https://b70f703d-roxy.mmaker.workers.dev'>Commit Preview URL</a><br><br><a href='https://feat-json-endpoint-roxy.mmaker.workers.dev'>Branch Preview URL</a> | Jun 01 2026, 08:45 AM |
Sign in to join this conversation.
No description provided.