Giter Site home page Giter Site logo

api-gateway's Introduction

twinte-api-gateway

各種サービスを取りまとめて外部apiとして公開する

アーキテクチャ

api-gatewayは殆どドメイン知識を持たないため、ペーシックな3層アーキテクチャです。

api-gateway
├── openapi-spec    openapiの定義が含まれる(submoduleでリンク)
├── services        各サービスの実装(submoduleでリンク・protoファイルと開発環境でのdocker imageビルドのみに使用)
│   ├── course-service
│   ├── timetable-service
│   └ ... (追加予定)
└── src
    ├── api         expressを用いたapiの実装
    │   └── routes  ルーティング
    ├── gateway     各サービスの呼び出しをラップ
    │   ├── courseService
    │   ├── sessionService
    │   ├── timetableService
    │   └ ... (追加予定)
    ├── type        共通で用いる型定義等
    └── usecase     ユースケース
folder 役割
api プレゼンテーション層
usecase ビジネスロジック層
gateway データアクセス層

利用方法

ビルド済みDockerImageが利用できます。

環境変数名 説明 default
COURSE_SERVICE_URL course-serviceの接続先 course:50051
TIMETABLE_SERVICE_URL timetable-serviceの接続先 timetable:50051
DONATION_SERVICE_URL donation-serviceの接続先 donation:50051
INFORMATION_SERVICE_URL information-serviceの接続先 information:50051
SCHOOL_CALENDAR_SERVICE_URL school-calendar-serviceの接続先 school-calendar:50051
SESSION_SERVICE_URL session-serviceの接続先 session:50051
COOKIE_NAME session-serviceに渡すidが含まれるCOOKIE名 twinte_session
LOG_LEVEL ログレベル fatal / error / warn / info / debug / trace / off info

開発方法

Docker + VSCodeを推奨します。 以下その方法を紹介します。

  1. RemoteDevelopment拡張機能をインストール
  2. このプロジェクトのフォルダを開く
  3. 右下に Folder contains a Dev Container configuration file. Reopen folder to develop in a container と案内が表示されるのでReopen in Containerを選択する。(表示されない場合はコマンドパレットを開きopen folder in containerと入力する)
  4. node14の開発用コンテナが立ち上がりVSCodeで開かれます。また、依存するサービス等も自動で起動します。
  5. yarn install で依存をインストールします。
  6. yarn openapi でopenapiスキーマから型定義ファイルを生成します
  7. yarn proto でgrpcに必要なファイルを生成します
  8. yarn dev で立ち上がります。

v3バックエンドサービス一覧

  • API Gateway (here)
  • Auth Callback
  • User Service
  • Session Service
  • Timetable Service
  • Course Service (here)
  • Search Service
  • Donation Service
  • School Calendar Service
  • Information Service
  • Task Service

api-gateway's People

Contributors

siy1121 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.