0
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 5 years have passed since last update.

GraphQL from boilerPlate 手順

Posted at
  1. configファイルでserveceNameとStageNameを指定(default/defaultはもう取られてる)
dev.env
PRISMA_ENDPOINT=http://192.168.99.100:4466/serviceName/stageName
test.env
PRISMA_ENDPOINT=http://192.168.99.100:4466/serviceName/test
> cd prisma
prisma > prisma deploy -e ../config/dev.env
prisma > prisma deploy -e ../config/test.env

デプロイしたらDependenciesをinstall npm install

.graphqlconfigをdev.envに合わせて npm run get-schema ⇒ src/generated/prisma.graphql を生成

.graphqlconfig
{
    "projects": {
        "prisma": {
            "schemaPath": "src/generated/prisma.graphql",
            "extensions": {
                "prisma": "prisma/prisma.yml",
                "endpoints": {
                    "default": "http://192.168.99.100:4466/serviceName/stageName"
                }
            }
        }
    }
}

npm run test でテスト環境の構築を確認
npm run dev でローカル開発環境構築の確認
http://localhost:4000/ にアクセス ⇒ query users で empty arrayが返ってくるのぐらいを確認)

prod.envのserviceNameを(必要ならサーバーのURLも)変更

prod.env
PRISMA_ENDPOINT=https://xxx.herokuapp.com/serviceName/prod
PRISMA_SECRET=xxxxx
JWT_SECRET=xxxxxxxxxx
> cd prisma
prisma > prisma deploy -e ../config/prod.env

プロジェクトのルートでheroku create でAppを作成(このとき remote repositoryも自動で作成される)
以下、prod.envに書かれてる環境変数を設定する

heroku config:set PRISMA_ENDPOINT=https://xxx.herokuapp.com/serviceName/prod PRISMA_SECRET=xxxxx JWT_SECRET=xxxxxxxxxx

heroku configで確認
git commit -am "setup project"
git push heroku master ⇒ production deploy
⇒ deploy終了後に提示されるURLにつなぐとGraphQLのPlaygroundにつながる

0
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
0
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?