CS 268: Lecture 14 – Fetch
Dear students:
Last time we examined objects and how to pass them around using JSON. This time, we apply these ideas by consuming a web service: News API. We’ll use JavaScript’s builtin fetch
function to grab and send JSON data.
We started looking at this before spring breeeaaak happened, but I’ve re-implemented the example we started for the sake of completeness.
Here’s your TODO list:
- Watch this video, in which we get a list of sources from News API.
- Watch this video, in which we retrieve headlines for the chosen source.
- As an optional knowledge boost, investigate these ideas further by reading. Consult The Modern JavaScript Tutorial’s sections on promises and fetch.
- You are encouraged to post a reply in the lecture 14 thread with one of the following:
- A question regarding promises,
fetch
, or web services. This might be a question you really don’t know the answer to or one that you do know the answer to and are putting forward as a challenge to your peers. - An answer to a previously posted question or challenge.
- A question regarding promises,
See you next time.
Sincerely,