Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-echo-api

Echoフレームワークを使用したGo REST APIサーバー。クリーンアーキテクチャで構築。

必要なツール

セットアップ

# PostgreSQL起動
docker compose up -d

# マイグレーション実行
task db:up

開発コマンド

# サーバー起動
task run

# テスト実行
task test

# フォーマット + 静的解析 + テスト
task check

API エンドポイント

メソッド パス 説明
GET /health ヘルスチェック
GET /users ユーザー一覧取得
POST /users ユーザー作成
GET /users/{id} ユーザー取得
PUT /users/{id} ユーザー更新
DELETE /users/{id} ユーザー削除

ディレクトリ構成

go-echo-api/
├── cmd/api/                 # エントリーポイント
├── internal/
│   ├── application/         # ユースケース層
│   │   └── user/
│   ├── domain/              # ドメイン層
│   │   └── user/
│   │       └── valueobject/
│   ├── infrastructure/      # インフラ層
│   │   └── repository/
│   │       └── postgres/
│   ├── presentation/        # プレゼンテーション層
│   │   └── http/
│   │       ├── handler/
│   │       │   ├── health/
│   │       │   └── user/
│   │       ├── errors/
│   │       └── validation/
│   └── di/                  # 依存性注入
├── db/migrations/           # マイグレーションファイル
├── docker-compose.yml
└── Taskfile.yml

技術スタック

カテゴリ 技術
言語 Go 1.21+
フレームワーク Echo v4
DB PostgreSQL 17
バリデーション go-playground/validator
マイグレーション golang-migrate
アーキテクチャ クリーンアーキテクチャ

About

echoを使ってapiを作成してみる

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages