Skip to content

Instantly share code, notes, and snippets.

@holmesal
Created November 30, 2016 22:01
Show Gist options
  • Save holmesal/eb9de55c8966fca56e6f7fe5d9b5ba7a to your computer and use it in GitHub Desktop.
Save holmesal/eb9de55c8966fca56e6f7fe5d9b5ba7a to your computer and use it in GitHub Desktop.
var QueryType = new GraphQLObjectType({
name: 'Query',
description: 'A type used to make queries',
fields: () => ({
node: nodeDefinitions.nodeField,
viewer: {
type: types.UserType,
description: 'The currently authenticated user',
resolve: (parent, _, {user}) => user
},
search: {
type: SearchResultConnection,
description: 'Search for things',
args: {
text: {
type: GraphQLString,
description: 'The text string to match',
required: true
},
...connectionArgs
},
resolve: (parent, {text}, context) => doSearch(text)
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment