diff --git a/seo/demo/pages/index.js b/seo/demo/pages/index.js index 1d2a018..eead3c1 100644 --- a/seo/demo/pages/index.js +++ b/seo/demo/pages/index.js @@ -74,7 +74,7 @@ export default function Start({ countries }) {
{country.name} - {country.population.toLocaleString()}
@@ -113,12 +113,16 @@ export default function Start({ countries }) { } export async function getServerSideProps() { - const response = await fetch("https://restcountries.eu/rest/v2/all") + const response = await fetch("https://restcountries.com/v3.1/all") const countries = await response.json() return { props: { - countries + countries: countries.map((country) => ({ + name: country.name.common, + cca2: country.cca2, + population: country.population, + })), } } } diff --git a/seo/pages/index.js b/seo/pages/index.js index fdb821b..c9dfc0e 100644 --- a/seo/pages/index.js +++ b/seo/pages/index.js @@ -63,7 +63,7 @@ export default function Start({ countries }) {{country.name} - {country.population.toLocaleString()}
@@ -100,12 +100,16 @@ export default function Start({ countries }) { } export async function getServerSideProps() { - const response = await fetch('https://restcountries.eu/rest/v2/all'); + const response = await fetch('https://restcountries.com/v3.1/all'); const countries = await response.json(); return { props: { - countries, + countries: countries.map((country) => ({ + name: country.name.common, + cca2: country.cca2, + population: country.population, + })), }, }; -} +} \ No newline at end of file