Created
June 21, 2020 18:58
-
-
Save shrirambalakrishnan/9f7b64e5af254822f961682e0d9863bc 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
const resolvers = { | |
UserType: { | |
posts: async (parent) => { | |
return await Post.findAll({where: {userId: parent.id}}); | |
} | |
}, | |
Query: { | |
users: async () => { | |
try { | |
return await User.findAll() | |
} catch (e) { | |
console.log(e) | |
} | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment