Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Last active June 14, 2018 21:06
Show Gist options
  • Select an option

  • Save daniele-zurico/d80dbdd04840ad9f6a2f5ded7025bb84 to your computer and use it in GitHub Desktop.

Select an option

Save daniele-zurico/d80dbdd04840ad9f6a2f5ded7025bb84 to your computer and use it in GitHub Desktop.
import {
addMockFunctionsToSchema,
gql,
makeExecutableSchema
} from "apollo-server";
import { GraphQLSchema } from "graphql";
const postSchema: GraphQLSchema = makeExecutableSchema({
typeDefs: gql`
type Query {
posts: [Post]
}
type Mutation {
addPost(author: String, comment: String): Post
}
type Post {
author: String
comment: String
}
type Subscription {
postAdded: Post
}
`
});
addMockFunctionsToSchema({ schema: postSchema });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment