Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

axios

Package Overview
Dependencies
Maintainers
4
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios

Promise based HTTP client for the browser and node.js

  • 1.3.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
decreased by-52.87%
Maintainers
4
Weekly downloads
Β 
Created

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

Keywords

FAQs

Package last updated on 05 Apr 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc