Let’s take a minute to appreciate what you’ve accomplished so far:
- used
fetch()
to make GET and POST requests. - check the status of the responses coming back
- catch errors that might possibly arise
- taking successful responses and rendering it on the webpage
That is fantastic! It’s the basis of how the internet works!
In the following exercises, we’re going to take what you’ve learned about chaining Promises and make it simpler using functionality introduced in ES8: async
and await
. You read that right, you did the hard part already, now it’s time to make it easier.
The structure for this request will also be slightly different. Notice the new keywords async
and await
, as well as the try
and catch
statements.
We’ll be going over how to write the boilerplate code for async
GET requests in the next lesson.
Instructions
Move on to the next exercise when you’re ready!