Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done! You have completed Practice Fetch API!
You have completed Practice Fetch API!
Preview
This video introduces the challenge that you’ll be working to complete
Prerequisites
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC] 0:00
Hi Team, Rohald here. 0:09
In this practice session, you'll solidify and 0:11
practice your skills with the Fetch API. 0:14
As a developer, 0:16
you'll often make network requests to retrieve data from a remote server. 0:17
This practice will allow you to apply your fetch API 0:21
knowledge firsthand by retrieving data from the REST countries API. 0:25
The REST countries API is a free-to-use open-source API 0:29
that contains various information about countries. 0:33
You can use it to retrieve information about a country's flag, capital, 0:37
currency, border countries, and much more. 0:41
When working with an external API, 0:44
you'll always wanna have a good look at their documentation. 0:46
In the docs, you'll find what endpoints are available and 0:50
what data they'll return. 0:53
You'll find a link to the documentation in the teacher's notes below this video. 0:55
Launch the workspace with this video to get started or 1:00
download the project files and use your preferred text editor. 1:03
In the index.html file, I've provided a snippet of the country card structure. 1:07
You can use this same structure to dynamically add the elements to the page 1:13
once the data is available. 1:18
In the app.js file, I've added some comments to help you get going. 1:19
To complete this practice, you'll have to create two separate functions, 1:24
one to retrieve the API data, and another to create the cards and 1:29
add them to the page dynamically. 1:33
Once you finish the challenge, your page should look like this. 1:35
For each country returned by the API, a card is added to the page. 1:40
Good luck, and have fun. 1:45
In the following video, I'll show you one possible solution to this challenge. 1:46
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up