Created
March 6, 2019 17:57
-
-
Save danedavid/d40fb5bb903d5777ad9a1c66efc93674 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 { RESTDataSource } = require('apollo-datasource-rest'); | |
class GoogleBooksAPI extends RESTDataSource { | |
constructor() { | |
super(); | |
this.baseURL = 'https://www.googleapis.com/books/v1/'; | |
} | |
async getBooks() { | |
const res = await this.get(`volumes?q=harry+potter`); | |
return res.items; | |
} | |
} | |
module.exports = { GoogleBooksAPI }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment