Axios
Learn how to properly mock API calls made with the popular Axios library.
We'll cover the following...
Why do we mock Axios?
Axios, one of the most popular packages available on the npm and Yarn registries, is “a Promise based HTTP client for the browser and node.js.” In other words, we can use it to make API calls both from our client and from our server, as long as they are both in JavaScript. It’s extremely helpful, abstracting much of the lengthy manual configurations of request creation into helper methods, such as axios.get
, axios.head
, and axios.request
. This makes our code more readable and easier to ...