Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Created June 2, 2021 15:41
Show Gist options
  • Save bengrunfeld/c533d093ad75522eed3ca5933ec63113 to your computer and use it in GitHub Desktop.
Save bengrunfeld/c533d093ad75522eed3ca5933ec63113 to your computer and use it in GitHub Desktop.
Scalable GraphQL User Resolvers
const queries = {
user: (root, args) => {
return {
id: "12345",
email: "some.user@email.com",
password: "Pa$$w0rd!",
loggedIn: false,
firstName: "Some",
lastName: "User",
};
},
};
const mutations = {
createUser: (root, args) => {
const newUser = {
id: "54321",
email: args.email,
password: args.password,
loggedIn: false,
firstName: args.firstName,
lastName: args.lastName,
};
return newUser;
},
};
export const resolvers = { queries, mutations };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment