Skip to content

Instantly share code, notes, and snippets.

@brycetshaw
Last active August 7, 2020 20:09
Show Gist options
  • Save brycetshaw/9cf3454bde3998d4ba2eac2ee375a9f1 to your computer and use it in GitHub Desktop.
Save brycetshaw/9cf3454bde3998d4ba2eac2ee375a9f1 to your computer and use it in GitHub Desktop.
Makes a network request!
const fetch = require('node-fetch');
async function getNumOfGamesFromPage(year, goals, page) {
const response = await fetch(queryString(year, goals, page))
.catch(err => console.log("get error " + err.message));
const json = await response.json();
if (page === 0) {
return [json.data.length, json.total_pages];
} else {
return json.data.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment