Skip to content

nishibu97/hono-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hono フレームワーク

公式ドキュメント

https://hono-ja.pages.dev/

To install dependencies:

Bunインストール

macOS & Linux

curl -fsSL https://bun.com/install | bash

Windows

powershell -c "irm bun.sh/install.ps1|iex"

Package Managers

npm

npm install -g bun # the last `npm` command you'll ever need

Homebrew

brew install oven-sh/bun/bun

起動

bun install

To run:

bun run dev

open http://localhost:30001

ディレクトリ構成

レイヤードアーキテクチャ

src/
├── index.ts                # App Entrypoint(エントリーポイント)
│
├── features/               # 【機能別スキーマ層】OpenAPI定義・バリデーション
│   └── auth/
│       └── auth.schema.ts  # 認証APIのスキーマ定義(Zod + OpenAPI)
│
├── interface/              # 【HTTP層】コントローラー・ルーティング
│   ├── auth.controller.ts  # 認証エンドポイント
│   └── user.controller.ts  # ユーザーエンドポイント
│
├── usecases/               # 【ロジック層】ビジネスロジック
│   ├── auth.usecase.ts     # 認証ロジック(JWT発行など)
│   └── user.usecase.ts     # ユーザー操作ロジック
│
├── infrastructure/         # 【DB層】データアクセス
│   └── repositories/       # リポジトリパターン
│       └── user.repository.ts  # ユーザーデータアクセス
│
├── domain/                 # 【ドメイン層】型定義・ビジネスモデル
│   └── models/
│       └── user.model.ts   # ユーザーモデル型定義
│
└── utils/                  # 【ユーティリティ層】共通処理
    └── hash.util.ts        # パスワードハッシュ化など

API仕様書(Swagger UI)

開発サーバーを起動後、ブラウザで以下にアクセス:

http://localhost:30001/ui

Swagger UIで以下が確認できます:

  • すべてのAPIエンドポイント一覧
  • リクエスト/レスポンスのスキーマ
  • 「Try it out」ボタンで実際にAPIをテスト可能

その他

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors