You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
332 B
10 lines
332 B
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
|