Skip to content

Instantly share code, notes, and snippets.

@martijnwalraven
Last active June 19, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martijnwalraven/0259c54d92f4394affea076377203b24 to your computer and use it in GitHub Desktop.
Save martijnwalraven/0259c54d92f4394affea076377203b24 to your computer and use it in GitHub Desktop.
class MoviesAPI extends RESTDataSource {
baseURL = 'https://movies-api.example.com';
async getMovie(id: string) {
return this.get(`movies/${id}`);
}
async getMostViewedMovies(limit: number = 10) {
const data = await this.get('movies', {
per_page: limit,
order_by: 'most_viewed',
});
return data.results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment