Skip to content

Instantly share code, notes, and snippets.

@ponyjackal
Created September 17, 2020 23:50
Show Gist options
  • Save ponyjackal/af19c50b6f7eab0ae0ac341f606f48f3 to your computer and use it in GitHub Desktop.
Save ponyjackal/af19c50b6f7eab0ae0ac341f606f48f3 to your computer and use it in GitHub Desktop.
GraphQL Query Builder
var Query = require('graphql-query-builder');
const client = new ApolloClient({
uri: 'http://localhost:4000',
});
function Test() {
const greeting = 'Hello Function Component!';
let organization = new Query("getOrganization",{id : 1});
organization.find(["name",{"users":["name",{"organization":["name",{"users":["name","email"]}]}]}]);
client
.query({
query : gql`{
${organization}
}`
})
.then(result => console.log(result));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment