axios update config code example

Example 1: AXIOS CDN

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

Example 2: axios post

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

Example 3: Using axios send a GET request to the address:

// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

// Optionally the request above could also be done as
axios.get('/user', {
    params: {
      ID: 12345
    }
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Example 4: axios

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

Example 5: axios put request

const res = await axios.put('https://httpbin.org/put', { hello: 'world' });

res.data.headers['Content-Type'];

Tags:

Misc Example