summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md74
1 files changed, 74 insertions, 0 deletions
diff --git a/README.md b/README.md
index 68b2c50..44ff96b 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,80 @@
| `/artists/of/:uuid/history` | アーティスト編集履歴 |
| `/artists/new` | アーティスト新規作成 |
+## API
+
+サーバー起動中に JSON API で操作できます。
+
+### バンド
+
+```bash
+# 一覧取得
+curl http://localhost:5173/api/bands
+
+# 新規作成
+curl -X POST http://localhost:5173/api/bands \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "バンド名",
+ "area": "Tokyo",
+ "status": "active",
+ "description": "説明文",
+ "links": [{"label": "Twitter", "url": "https://..."}],
+ "artists": [{"id": "<artist-uuid>", "role": "Vocal"}],
+ "message": "初回登録"
+ }'
+```
+
+### アーティスト
+
+```bash
+# 一覧取得
+curl http://localhost:5173/api/artists
+
+# 新規作成
+curl -X POST http://localhost:5173/api/artists \
+ -H "Content-Type: application/json" \
+ -d '{"name": "アーティスト名", "links": [{"label": "Twitter", "url": "https://..."}]}'
+```
+
+`slug` は省略すると名前から自動生成。成功時は `201` + 作成したレコードの JSON を返します。slug 重複時は `409`。
+
+## CLI
+
+サーバー不要でローカルの DB に直接書き込みます。プロジェクトルートから実行してください。
+
+```bash
+# アーティスト登録
+npm run add -- artist --name "アーティスト名"
+
+# バンド登録
+npm run add -- band --name "バンド名" --area Tokyo --status active
+
+# JSON ファイルから一括インポート
+npm run add -- import --file data.json
+```
+
+### 一括インポートの JSON 形式
+
+```json
+{
+ "artists": [
+ {"name": "アーティスト A", "links": [{"label": "Twitter", "url": "https://..."}]}
+ ],
+ "bands": [
+ {
+ "name": "バンド X",
+ "area": "Tokyo",
+ "status": "active",
+ "artists": [{"name": "アーティスト A", "role": "Vocal"}],
+ "links": [{"label": "Twitter", "url": "https://..."}]
+ }
+ ]
+}
+```
+
+`artists` を先に処理するので、`bands` 側でアーティスト名を参照できます。既存のアーティスト(名前一致)はスキップ。
+
## 技術スタック
- [React Router v7](https://reactrouter.com/) (SSR フレームワーク)