GraphCool 介紹
安裝 GraphQL Server 教學
這裡會紀錄 GraphQL 也稱 GraphCool 的操作
安裝
首先,用管理員權限開啟 cmd,安裝graphcool
安裝 graphcool
npm install -g graphcool
初始化graphcool專案
接著,前往專案資料夾,建立 local 端的graphcool管理初始化
graphcool init
Deploy
安裝完畢後,會看到選項 graphcool deploy, 將你的Graphcool server發布在線上 graphcool local up, 開始你的本地端Graphcool graphcool add-template facebook-auth, 加入facebook 驗證
我們先選擇線上發布
graphcool deploy
線上管理介面
接著,會自動開啟瀏覽器,前往 https://console.graph.cool/graphql/schema 這時,開啟本地端的 types.graphql 會發現裡面的 schema 已經被發佈到線上
現在,新增一個 Test types.graphql
type User @model {
id: ID! @isUnique
name: String
dateOfBirth: DateTime
# Uncomment below - you can declare relations between models like this
# posts: [Post!]! @relation(name: "UserPosts")
}
type Test @model {
id: ID! @isUnique
namesss: String
dateOfBirth: DateTime
# Uncomment below - you can declare relations between models like this
# posts: [Post!]! @relation(name: "UserPosts")
}
再輸入發布指令
Continue Reading