Skip to Content

Axios

image

Description

what is it ? : Javascript API client Library intended to build and hanlde API calls .
URL : official website 
version : 0.27.2
**Why ? : **

  • Lightweight
  • Built in JSON data transformation
  • Support Interecptors for both Requests and Responses

Application

// axios axios.post('https://api.github.com/orgs/axios', { id: 1 }).then( response => { console.log(response.data); }, error => { console.log(error); } ); // fetch() fetch('https://api.github.com/orgs/axios',{ method:"POST", body: body: JSON.stringify({id:1})// extra step to hanlde "Stringifying" }) .then(response => response.json()) // one extra step .then(data => { console.log(data); }) .catch(error => console.error(error));
Last updated on