Skip to content

Instantly share code, notes, and snippets.

@felipe-ssilva
Created June 7, 2019 22:06
Show Gist options
  • Save felipe-ssilva/50225d71fabd4a7f4b928d06ffbdd657 to your computer and use it in GitHub Desktop.
Save felipe-ssilva/50225d71fabd4a7f4b928d06ffbdd657 to your computer and use it in GitHub Desktop.
const typeDefs = `
type Mutation {
createUser(name: String!, email: String!): User
}
`;
const resolvers = {
Mutation: {
createUser: (parent, args) => {
const newUser = Object.assign({id: users.length + 1}, args);
users.push(newUser);
return newUser;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment