Closed ju-ki closed 2 months ago
この変更は、LaravelバックエンドとReactフロントエンドの統合を強化するための新しいAPIエンドポイントとコンポーネントを追加します。ポストの取得機能を持つPostController
、APIルーティングの構成、認証のためのLaravel Sanctumの導入、さらにフロントエンドでのポスト表示機能を持つ新しいPosts
コンポーネントが導入されました。これにより、開発者はシンプルかつ効率的にデータをやり取りできるようになります。
ファイルパス | 変更の概要 |
---|---|
Makefile |
ルートキャッシュとリスト表示のための新しいターゲットを追加。 |
backend/app/Http/Controllers/API/PostController.php |
ポストのリストを取得するAPIエンドポイントを提供するPostController クラスを追加。index メソッドがJSONレスポンスを返す。 |
backend/bootstrap/app.php |
API用の新しいルーティングエントリを追加し、api.php ファイルを参照。 |
backend/composer.json |
"laravel/sanctum": "^4.0" を依存関係に追加し、APIトークン認証を有効にする。 |
backend/config/sanctum.php |
Sanctumの設定ファイルを追加し、API認証に必要な設定を提供。 |
backend/database/migrations/... |
personal_access_tokens テーブルを作成するマイグレーションを追加。 |
backend/routes/api.php |
ポスト管理のためにPostController を利用したリソースルートを追加し、認証ユーザー取得のための新しいエンドポイントも追加。 |
backend/tests/Feature/API/PostTest.php |
ポスト一覧取得APIエンドポイントのテストケースを追加。 |
frontend/__test__/pages/Posts.spec.tsx |
Posts コンポーネントのユニットテストを追加、現在はコンポーネントのレンダリング準備のみ。 |
frontend/bunfig.toml |
テスト用に[test] セクションを追加、preload を設定。 |
frontend/happydom.ts |
グローバルコンポーネントの登録を行う新しいファイルを追加。 |
frontend/package.json |
テストライブラリやAxiosの新しい依存関係を追加。 |
frontend/src/pages/posts.tsx |
ポストを取得して表示するPosts コンポーネントを新規作成。 |
sequenceDiagram
participant User
participant Frontend
participant API
participant Controller
User->>Frontend: ポスト一覧をリクエスト
Frontend->>API: GET /api/posts
API->>Controller: indexメソッドを呼び出し
Controller-->>API: JSONレスポンスを返す
API-->>Frontend: ポストデータを返す
Frontend-->>User: ポストを表示
うさぎが跳ねる、喜びの舞、
新しいポストが、光を浴び、
APIも整え、夢膨らむ、
みんな集まれ、ポストを楽しもう!
みんなの声が、響くこの場所で、
ハッピーな道を、進もう一緒に! 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai review
This PR is automatically created by GitHub Actions
Summary by CodeRabbit
新機能
バグ修正
テスト