Let's start off by creating a new Vue.js project that we can use as a playground project. Type the following in your Terminal:
# Create a new Vue project $ vue init webpack-simple vue-http # Navigate to directory $ cd vue-http
# Install dependencies $ npm install # Run application $ npm run dev
There are many ways to create HTTP requests within JavaScript. We'll be using the Axios
library to use a simplified promise-based approach within our project. Let's install it by typing the following in our Terminal:
# Install Axios to our project
$ npm install axios --save
We now have the ability to create HTTP requests; we just need an API to point Axios
towards. Let's create a mock API.