Last active
January 23, 2019 13:47
-
-
Save ronderksen/bd6f88d1940f4ad374a222b950e029bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export const myResolver = { | |
Query: { | |
getTodo: (_, { id }, { dataSources }) { | |
return dataSources.todoAPI.getTodo(id) | |
} | |
} | |
} |
This file contains hidden or 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
import { RESTDataSource } from 'apollo-datasource-rest'; | |
export class TodoAPI extends RESTDataSource { | |
getTodo(id) { | |
return this.get(`/todo/${id}`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment