Guest User

Untitled

a guest
Sep 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. //import your Player model to retrieve data from your players collection.
  2. const Player = require('./connectors');
  3. //Define your resolver
  4. const resolvers = {
  5. Query: {
  6. players: () => Player.find({}, (error, players) => {
  7. //If there is an errror throw the error on your graphql playground.
  8. if(error) throw new Error(error);
  9. console.log('players-------', players);
  10. //Else return your players.
  11. return players;
  12. })
  13. }
  14. }
  15.  
  16. module.exports = resolvers;
Add Comment
Please, Sign In to add comment