title | description | created | updated |
---|---|---|---|
axios (Javascript Library) |
Axios is promise based HTTP client for both clientside and server side |
2019-06-21 |
2019-06-21 |
Axios is promise based HTTP client for both clientside and server side
npm install axios
const axios = require('axios');
axios.get('https://httpbin.org/get')
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
const response = await axios.get('https://httpbin.org/get');
console.log(response);
axios.post('https://httpbin.org/post', {
foo: "bar"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});