Skip to content

rongfengliang/dgraph-cluster-graphql-learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 

Repository files navigation

dgraph cluster with graphql

How to Running

  • Start service
docker-compose up -d
  • deploy schema

can execute in any alpha server (Note: change request url)

curl -X POST localhost:8080/admin/schema -d '@schema.graphql'
  • Do some mutation
mutation {
  addProduct(input: [
    { name: "GraphQL on Dgraph"},
    { name: "Dgraph: The GraphQL Database"}
  ]) {
    product {
      productID
      name
    }
  }
  addCustomer(input: [{ username: "Michael"}]) {
    customer {
      username
    }
  }
}

---------
mutation {
  addReview(input: [{
    by: {username: "Michael"}, 
    about: { productID: "0x3"}, 
    comment: "Fantastic, easy to install, worked great.  Best GraphQL server available",
    rating: 10}]) 
  {
    review {
      comment
      rating
      by { username }
      about { name }
    }
  }
}
  • Do some query
query {
  queryProduct {
    productID
    name
    reviews {
      id
      rating
      comment
    }
  }
}

About

dgraph-cluster-graphql-learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published