# Getting Started

# What is Axios?

Axios is a promise-based (opens new window) HTTP Client for node.js (opens new window) and the browser. It is isomorphic (opens new window) (= it can run in the browser and nodejs with the same codebase). On the server-side it uses the native node.js http module, while on the client (browser) it uses XMLHttpRequests.

# Features

  • Make XMLHttpRequests (opens new window) from the browser
  • Make http (opens new window) requests from node.js
  • Supports the Promise (opens new window) API
  • Intercept request and response
  • Transform request and response data
  • Cancel requests
  • Timeouts
  • Query parameters serialization with support for nested entries
  • Automatic request body serialization to:
    • JSON (application/json)
    • Multipart / FormData (multipart/form-data)
    • URL encoded form (application/x-www-form-urlencoded)
  • Posting HTML forms as JSON
  • Automatic JSON data handling in response
  • Progress capturing for browsers and node.js with extra info (speed rate, remaining time)
  • Setting bandwidth limits for node.js
  • Compatible with spec-compliant FormData and Blob (including node.js)
  • Client side support for protecting against XSRF (opens new window)

# Installing

Using npm:

$ npm install axios

Using bower:

$ bower install axios

Using yarn:

$ yarn add axios

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

Using unpkg CDN:

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

Prebuilt CommonJS modules for direct importing with require (if your module bundler failed to resolve them automatically)

const axios = require('axios/dist/browser/axios.cjs'); // browser
const axios = require('axios/dist/node/axios.cjs'); // node
Last Updated: 6/17/2023, 6:57:19 PM