Learn

In this lesson, we learned how to make GET and POST requests using the Fetch API and async/await keywords. Let’s recap on the concepts covered in the previous exercises:

  • GET and POST requests can be created in a variety of ways.
  • We can use fetch() and async/await to asynchronous request data from APIs.
  • Promises are a type of JavaScript object that represents data that will eventually be returned from a request.
  • The fetch() function can be used to create requests and will return promises.
  • We can chain .then() methods to handle promises returned by the fetch() function.
  • The async keyword is used to create asynchronous functions that will return promises.
  • The await keyword can only be used with functions declared with the async keyword.
  • The await keyword suspends the program while waiting for a promise to resolve.

Congratulations on learning all about asynchronous requests using fetch(), async, and await! These concepts are fundamental to helping you develop more robust web apps!

Instructions

Play around with the browser and code to make GET and POST requests. To make POST requests to the Rebrandly API, make sure you assign apiKey your Rebrandly API key and run the code!

If you want to challenge yourself:

  • Rewrite the requests from scratch.
  • Replace the helper functions (renderResponse() in public/helperFunctions.js) with your own code.
  • Use different APIs to make GET/POST requests using async/await.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?