Skip to content

Instantly share code, notes, and snippets.

@marcusstenbeck
Last active January 14, 2018 12:02
Show Gist options
  • Save marcusstenbeck/3eacc466d6163ef7f988185ef793253f to your computer and use it in GitHub Desktop.
Save marcusstenbeck/3eacc466d6163ef7f988185ef793253f to your computer and use it in GitHub Desktop.
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