Initial commit

This commit is contained in:
Joshua Seigler 2020-01-28 23:08:53 -05:00
commit 0bd76ac5dc
8 changed files with 1386 additions and 0 deletions

33
server/schema/schema.js Normal file
View file

@ -0,0 +1,33 @@
const graphql = require('graphql');
const {
GraphQLObjectType,
GraphQLString,
GraphQLSchema
} = graphql;
const BookType = new GraphQLObjectType({
name: 'Book',
fields: () => ({
id: { type: GraphQLString },
name: { type: GraphQLString },
genre: { type: GraphQLString }
})
});
const RootQuery = new GraphQLObjectType({
name: 'RootQueryType',
fields: {
book: {
type: BookType,
args: { id: { GraphQLString } },
resolve (parent, { id }) {
// code to retrieve data from db or other source
}
}
}
});
module.exports = new GraphQLSchema({
query: RootQuery
});