JavaScript fetch() Lab
Objectives
- Use
fetch()
to get remote data from GitHub - Use
fetch()
to write data to GitHub
Introduction
Make sure students understand the ins and outs of fetch()
-- e.g., the options object, headers, etc.
Walk students through signing up for a GitHub auth token (click avatar in upper right, click "Settings", "click "Personal access tokens" on the side bar, generate a new token)
Have students practice creating issues on a repository (it could even be this repository)
For the tests, redefine a global fetch as a spy and make sure that the student's functions are calling the right endpoint(s)