Giter Site home page Giter Site logo

2022beginnertrainingfrontend's Introduction

2022BeginnerTrainingFrontEnd

Getting started

Node.js v16 系を推奨しています。

このリポジトリでは Git Submodules を利用しています。

Git Submodules を含めた clone には下記のコマンドを実行してください。

git clone --recursive https://github.com/mixigroup/2022BeginnerTrainingFrontEnd.git

gh コマンドを利用している場合や、 --recursive オプションをつけずに clone した場合は、下記のコマンドを実行することで Git Submodules を clone することができます。

git submodule update --init --recursive

下記コマンドの実行の前に、 api-server パッケージのセットアップを完了してください。

npm install
npm run build:api-client
npm run dev:client

クライアント用の開発用 Web サーバーが立ち上がると http://localhost:8080 にアクセスすることで動作を確認することができます。

プロジェクト構成

npm workspace を利用して API サーバーと web クライアントの2パッケージに分けてプロジェクトを管理しています。

client

Web クライアントのアプリケーション本体のパッケージです。

Web API として api-server パッケージに依存しているので、アプリケーション本体の利用のためには api-server のクライアント向けコードの生成と API サーバーの用意が必要です。

アプリケーションの利用には、依存パッケージのセットアップの後に下記の通り従ってください。

cd packages/client
npm install
npm run dev

api-server

API サーバー本体の参照と Open API 定義 から生成した Web クライアント向けコードを ES Module として export しているパッケージです。

Git Submodules で API サーバーの Git リポジトリを紐づけています。

API サーバーをローカルで立ち上げるには下記の手順に従ってください。

cd packages/api-server/submodules/spa_guide_sns_server
npm install --production
rm -rf db.sqlite3
touch db.sqlite3
npm run start_migrate
npm run start_release

上記のコマンドで http://localhost:3000 に API サーバーが立ち上がります。

なお http://localhost:3000/api-docs で OpenAPI の API 定義を確認することができます。

API のスキーマは openapi.yaml に定義されており、スキーマ定義からクライアント向けのコードを ES Modules として生成することができます。

クライアント向けのコードを生成するには下記の手順に従ってください。

cd packages/api-server
npm install
npm run build

2022beginnertrainingfrontend's People

Contributors

yutaroyoshikawa 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.