Skip to content
Permalink
Browse files

inital graphql test version

  • Loading branch information...
mikemjharris committed Sep 14, 2018
1 parent 2969b9b commit ffd3b05047d3441d6c3c7070d560810c1fc5a10c
Showing with 32 additions and 0 deletions.
  1. +32 −0 server/server.js
@@ -21,6 +21,38 @@ app.use(express.static(path.join(__dirname, '../dist')));
// set the view engine to ejs
app.set('view engine', 'ejs')

let books = [{"title": "test"}]

const getBooks = () => { return books; };

const schema = buildSchema(`
type Query {
books: [Book]
},
type Book{
title: String,
}
`);

const bookType = new GraphQLObjectType({
name: 'book',
fields: () => ({
title: { type: GraphQLString },
date: { type: GraphQLDateTime }
})
});

const root = {
books: getBooks,
};

app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true,
}));


require('./routes/main')(app);

// blog home page

0 comments on commit ffd3b05

Please sign in to comment.
You can’t perform that action at this time.