Fetch API Lab
In this lab, you will practice using the Fetch API to make an HTTP request to a publicly available REST API. The goal is to build a simple web application to search and display user details from GitHub using their API.
To complete this lab, create an
index.html file with a form containing an input field with the id
username and a submit button with the id
getUserInfo which uses the Fetch API to call the GitHub API (
On successful submission, display the username and the public repository count on the
index.html page. Create a div with an id
results where the output will be displayed.
In case of any error or if the user is not available, show 'User not found' in the
- Fetch API
- DOM manipulation
- Dealing with API errors
- Use of GitHub API