Skip to content

Instantly share code, notes, and snippets.

@JakeDawkins
Last active May 15, 2018 06:19
Show Gist options
  • Select an option

  • Save JakeDawkins/71733cc525399c2275e324b0d4d3d317 to your computer and use it in GitHub Desktop.

Select an option

Save JakeDawkins/71733cc525399c2275e324b0d4d3d317 to your computer and use it in GitHub Desktop.
// src/server.js
context: ({ req }) => {
// pass the request information through to the model
return {
user,
models: {
User: generateUserModel({ req }),
...
}
};
},
// src/models/user.js
export const generateUserModel = ({ req }) => ({
getAll: () => {
return fetch('http://myurl.com/users', { headers: req.headers });
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment