Last active
October 9, 2017 14:38
-
-
Save jthegedus/2d6eebab750fcf3e95d992d76e205c93 to your computer and use it in GitHub Desktop.
Cloud Functions for Firebase - GraphQL Server - /functionsES6/graphql/data/schema.js
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 Author { | |
id: Int! # the ! means that every author object _must_ have an id | |
firstName: String | |
lastName: String | |
posts: [Post] # the list of Posts by this author | |
} | |
type Post { | |
id: Int! | |
title: String | |
author: Author | |
votes: Int | |
} | |
# the schema allows the following query: | |
type Query { | |
posts: [Post] | |
author(id: Int!): Author | |
} | |
# this schema allows the following mutation: | |
type Mutation { | |
upvotePost ( | |
postId: Int! | |
): Post | |
} | |
` | |
export default makeExecutableSchema({ | |
typeDefs: schema, | |
resolvers | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment