Socket
Socket
Sign inDemoInstall

axios

Package Overview
Dependencies
4
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    axios

Promise based HTTP client for the browser and node.js


Version published
Weekly downloads
49M
increased by1.06%
Maintainers
2
Install size
319 kB
Created
Weekly downloads
 

Package description

What is axios?

Axios is a promise-based HTTP client for the browser and Node.js. It provides an easy-to-use API for sending asynchronous HTTP requests to REST endpoints and performing CRUD operations. It can be used to make XMLHttpRequests from the browser or HTTP requests from Node.js, supports the Promise API, and provides a way to intercept request and response, transform request and response data, and cancel requests.

What are axios's main functionalities?

Performing GET requests

This feature allows you to perform a GET request to retrieve data from a specified resource.

axios.get('/user?ID=12345').then(function (response) { console.log(response); }).catch(function (error) { console.log(error); });

Performing POST requests

This feature allows you to perform a POST request to send data to a server to create/update a resource.

axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }).then(function (response) { console.log(response); }).catch(function (error) { console.log(error); });

Performing concurrent requests

This feature allows you to make multiple requests simultaneously.

axios.all([axios.get('/user/12345'), axios.get('/user/67890')]).then(axios.spread(function (acct, perms) { console.log(acct, perms); }));

Interceptors

This feature allows you to intercept requests or responses before they are handled by then or catch.

axios.interceptors.request.use(function (config) { config.headers.Authorization = AUTH_TOKEN; return config; }, function (error) { return Promise.reject(error); });

Creating instances

This feature allows you to create a new instance of axios with custom config defaults.

const instance = axios.create({ baseURL: 'https://api.example.com' }); instance.get('/users').then(function (response) { console.log(response); });

Other packages similar to axios

Readme

Source

axios // core

The modules found in core/ should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are:

  • Dispatching requests
  • Managing interceptors
  • Handling config

Keywords

FAQs

Last updated on 27 Aug 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc