Skip to content

Instantly share code, notes, and snippets.

@MCarlomagno
Created September 11, 2020 02:07
Show Gist options
  • Save MCarlomagno/d3843b0d1e30ad324a82bc623b362f68 to your computer and use it in GitHub Desktop.
Save MCarlomagno/d3843b0d1e30ad324a82bc623b362f68 to your computer and use it in GitHub Desktop.
const fetchTweets = async (text) => {
// fetch tweets from server
// enviroment [string]: Base url to the express.js server app
// text [string]: username of the tweets author
// tweetsToSearch [number]: number of tweets (10, 20, 50 or 100)
const result = await fetch(`${enviroment}/twits/${text}/${tweetsToSearch}`);
const response = await result.json();
return response.body;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment