Skip to content

Instantly share code, notes, and snippets.

@Matt-Dionis
Created July 21, 2017 21:26
Show Gist options
  • Save Matt-Dionis/60ed3418fe1ae36802565c0e8efae242 to your computer and use it in GitHub Desktop.
Save Matt-Dionis/60ed3418fe1ae36802565c0e8efae242 to your computer and use it in GitHub Desktop.
A sample GraphQL RootQueryType
const RootQueryType = new graphql.GraphQLObjectType({
name: 'RootQueryType',
fields: {
accounts: {
type: new graphql.GraphQLList(Account),
description: 'A list of accounts.',
args: {
accountType: {
type: AccountType
},
currencyCode: {
type: graphql.GraphQLString
},
endDate: {
type: GraphQLDate
},
startDate: {
type: GraphQLDate
}
},
resolve: (root, args) => {
// the accounts controller handles data querying based on 'args' passed to query
return controllers.accounts.get(args);
}
}
}
});
@NetOpWibby
Copy link

What does the accounts controller look like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment