Skip to content

Instantly share code, notes, and snippets.

@estreeper
Last active February 23, 2016 09:54
Show Gist options
  • Save estreeper/b91ca200da5e4ef15cba to your computer and use it in GitHub Desktop.
Save estreeper/b91ca200da5e4ef15cba to your computer and use it in GitHub Desktop.
var studentType = new graphql.GraphQLObjectType({
name: 'Student',
fields: {
// student fields here
},
});
var schoolType = new graphql.GraphQLObjectType({
name: 'School',
fields: {
schoolId: { type: graphql.GraphQLString },
name: { type: graphql.GraphQLString },
students: {
type: new GraphQLList(studentType),
resolve: function (school) { return someMethodToGetListofStudentsFromDatabase(school.schoolId); },
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment