Skip to content

Instantly share code, notes, and snippets.

@danedavid
Created March 6, 2019 17:57
Show Gist options
  • Save danedavid/d40fb5bb903d5777ad9a1c66efc93674 to your computer and use it in GitHub Desktop.
Save danedavid/d40fb5bb903d5777ad9a1c66efc93674 to your computer and use it in GitHub Desktop.
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