Created
August 21, 2017 01:25
-
-
Save JeffML/0b27d6b93526946a2ef174894610b1e8 to your computer and use it in GitHub Desktop.
Refactoring authorposts schema
This file contains hidden or 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
export default ` | |
type Post { | |
id: Int! | |
title: String | |
author: Author | |
votes: Int | |
}` |
This file contains hidden or 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 Author from './components/author' | |
import Post from './components/post' | |
const typeDefs = | |
` | |
# the schema allows the following query: | |
extend type Query { | |
posts: [Post] | |
author(id: Int!): Author | |
} | |
# this schema allows the following mutation: | |
extend type Mutation { | |
upvotePost ( | |
postId: Int! | |
): Post | |
} | |
`; | |
export default [typeDefs, Author, Post]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment