Skip to content

Instantly share code, notes, and snippets.

@aligos
Created November 5, 2016 06:40
Show Gist options
  • Save aligos/5eb92a4ecf39b182d484c82fe5f3955a to your computer and use it in GitHub Desktop.
Save aligos/5eb92a4ecf39b182d484c82fe5f3955a to your computer and use it in GitHub Desktop.
schema js votemon-server
import { makeExecutableSchema } from 'graphql-tools';
import resolvers from './resolvers';
const schema = `
type Type {
id: Int! # the ! means that every author object _must_ have an id
title: String
pokemons: [Pokemon] # the list of Posts by this author
}
type Pokemon {
id: Int!
name: String
image: String
type: Type
votes: Int
}
# the schema allows the following query:
type Query {
pokemons: [Pokemon]
}
# this schema allows the following mutation:
type Mutation {
upvotePokemon (
pokemonId: Int!
): Pokemon
}
type Subscription {
pokemonUpvoted: Pokemon
}
`;
export default makeExecutableSchema({
typeDefs: schema,
resolvers,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment