Created
June 5, 2018 11:16
-
-
Save daniele-zurico/7497a4b46616d91c85e6da138c2b3626 to your computer and use it in GitHub Desktop.
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 { | |
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