Skip to content

Instantly share code, notes, and snippets.

@gdyrrahitis
Created July 10, 2019 19:48
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 gdyrrahitis/d0cb5086fcb570bc470c7f7b97c4ea8c to your computer and use it in GitHub Desktop.
Save gdyrrahitis/d0cb5086fcb570bc470c7f7b97c4ea8c to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch');
const url = 'https://restcountries.eu/rest/v2/alpha/gb';
async function getCountry() {
return url
|> fetch
|> await
|> r => r.json()
|> await
|> c => {
return {
name: c.name,
capital: c.capital,
population: c.population,
flag: c.flag
}
};
}
(async () => {
const response = await getCountry();
console.log(response);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment