1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

福岡モツ鍋クラブAdvent Calendar 2021

Day 2

Next.js + Apollo Client + Hasuraのテンプレート

Posted at

リポジトリのURL

構成要素

  • TypeScript
  • next.js(React フレームワーク)
  • apollo/client(graphql クライアント)
  • graphql-codegen(graphqlAPI を呼び出すコードを生成する)
  • hasura(graphql サーバー)
  • PostgresSQL(DB、graphql バックエンドとして使用)
  • eslint(lintツール)
  • prettier(コードフォーマッター)

初回準備

  • yarn install
  • VS Codeに以下のextensionを追加
    1. ESLint
    2. Prettier

使い方

  1. yarn run devでnext.jsのサーバを起動
  2. docker-compose upでhasuraとPostgresSQLを起動
  3. yarn hasura console --project hasuraでhasuraのGUIコンソールを起動

TypeScript

  • tsファイルの中で、@src/以下にアクセスできる
    • 例: import hoge from "@/libs/hoge"

next.js

  • pagesディレクトリを削除し、src/pagessrc/componentsを追加

VS Code

  • 保存時にコード整形が行われる
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?