https://github.com/monmaru/gae-graphql
https://github.com/monmaru/gae-graphql
appengine datastore golang graphql
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/monmaru/gae-graphql
- Owner: monmaru
- License: mit
- Created: 2018-12-07T13:06:53.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-16T08:53:50.000Z (about 7 years ago)
- Last Synced: 2025-05-22T21:05:12.119Z (9 months ago)
- Topics: appengine, datastore, golang, graphql
- Language: Go
- Size: 65.4 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gae-graphql
## Deploy
### Create Datastore indexes
`gcloud datastore indexes create index.yaml`
### Deploy App Engine
`gcloud app deploy`
## Local debugging
### Running the Cloud Datastore Emulator
https://cloud.google.com/datastore/docs/tools/datastore-emulator
### Run
`go run server.go`
## How to use
### 1. Creating users
POST
```
mutation {
taro: createUser(name: "Taro", email: "taro@gmail.com") {
id
name
}
jiro: createUser(name: "Jiro", email: "jiro@gmail.com") {
id
name
}
}
```
### 2. Creating blogs
POST
```
mutation {
a: createBlog(userId: "5153049148391424", title: "title1", content: "Hello World!") {
id
title
content
}
b: createBlog(userId: "5153049148391424", title: "title2", content: "good morning") {
id
title
content
}
c: createBlog(userId: "5635703144710144", title: "title3", content: "GraphQL is nice") {
id
title
content
}
}
```
### 3. Query blogs with limit and offset
POST
```
{
blogs(limit: 1, offset: 1) {
totalCount
nodes {
id
title
content
createdAt
}
}
}
```
### 4. Query user by user id
POST
```
{
user(id: "5715161717407744") {
name
email
posts {
totalCount
nodes {
title
content
}
}
}
}
```