Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Last active October 25, 2018 09:31
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 SaraVieira/5029c4daa338820a8b36b4b953393e0b to your computer and use it in GitHub Desktop.
Save SaraVieira/5029c4daa338820a8b36b4b953393e0b to your computer and use it in GitHub Desktop.
const { RESTDataSource } = require("apollo-datasource-rest");
class RandomUser extends RESTDataSource {
constructor() {
super();
this.baseURL = "https://randomuser.me/api";
}
async getUser() {
const user = await this.get("/");
return user.results[0];
}
}
module.exports = RandomUser;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment