Last active
January 14, 2018 12:02
-
-
Save marcusstenbeck/3eacc466d6163ef7f988185ef793253f to your computer and use it in GitHub Desktop.
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 { makeExecutableSchema } = require('graphql-tools'); | |
const { GraphQLDateTime } = require('graphql-iso-date'); | |
const gql = require('graphql-tag'); | |
const typeDefs = gql` | |
scalar DateTime | |
type Show { | |
title: String! | |
time: DateTime! | |
host: String! | |
location: String! | |
} | |
type Query { | |
allShows: [Show!]! | |
} | |
type Mutation { | |
addShow( | |
title: String! | |
time: DateTime! | |
host: String! | |
location: String! | |
): Boolean | |
} | |
`; | |
module.exports = makeExecutableSchema({ | |
typeDefs, | |
resolvers: { | |
DateTime: GraphQLDateTime, | |
Query: { | |
allShows: () => [] | |
}, | |
Mutation: { | |
addShow: (_, data) => true | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment