setup axios code example
Example 1: install axios
$ npm install axios
Example 2: AXIOS CDN
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Example 3: axios get
import axios from 'axios';
await axios.get('/user', {
params: {
ID: 12345
}
})
Example 4: axios
axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' })
.then( response => { })
.catch( error => { });
Example 5: Axios get
const axios = require('axios');
async function makeGetRequest() {
let res = await axios.get('http://webcode.me');
let data = res.data;
console.log(data);
}
makeGetRequest();