Created
July 21, 2017 21:26
-
-
Save Matt-Dionis/60ed3418fe1ae36802565c0e8efae242 to your computer and use it in GitHub Desktop.
A sample GraphQL RootQueryType
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does the accounts controller look like?