Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Created June 5, 2018 11:16
Show Gist options
  • Save daniele-zurico/7497a4b46616d91c85e6da138c2b3626 to your computer and use it in GitHub Desktop.
Save daniele-zurico/7497a4b46616d91c85e6da138c2b3626 to your computer and use it in GitHub Desktop.
import {
addMockFunctionsToSchema,
gql,
makeExecutableSchema
} from "apollo-server";
import { GraphQLSchema } from "graphql";
const userSchema: GraphQLSchema = makeExecutableSchema({
typeDefs: gql`
type Query {
allUsers: [User]
}
type Mutation {
addUser(name: String!, surname: String!): User
deleteUser(id: String!): User
updateUser(id: String!, name: String, surname: String): User
}
type User {
_id: String
name: String
surname: String
}
`
});
addMockFunctionsToSchema({ schema: userSchema });
export default userSchema;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment