Created
November 5, 2016 06:40
-
-
Save aligos/5eb92a4ecf39b182d484c82fe5f3955a to your computer and use it in GitHub Desktop.
schema js votemon-server
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
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