parent
e4af287d59
commit
b986540e05
@ -1,2 +1,10 @@
|
||||
console.log(countries)
|
||||
alert('Open the console and check if the countries has been loaded')
|
||||
import fetch from "node-fetch";
|
||||
|
||||
const url = 'https://restcountries.com/v2/all' // countries api
|
||||
fetch(url)
|
||||
.then(response => response.json()) // accessing the API data as JSON
|
||||
.then(data => {
|
||||
// getting the data
|
||||
console.log(data)
|
||||
})
|
||||
.catch(error => console.error(error)) // handling error if something wrong happens
|
Loading…
Reference in new issue