Installing Axios


Adding Axios to your VueJS application

Axios is a JavaScript package and can be installed through different methods:

  • Include Axios from a CDN (Content Delivery Network) - easiest way
  • Download Axios manually and add the .js file to your page.
  • Use NPM(Node Package Manager) to install and add it to your project’s dependancies. - recommended for large applications 

Axios CDN

If you don't want to download and host Axios yourself, you can include it from a CDN (Content Delivery Network). Just place below code before your closing </body> tag:

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

Using NPM

Install the latest version of Axios using NPM:

npm install axios --save

And the set it on the window object so we can start using it in our project:

window.axios = require('axios');

Comments: