Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make a post request from axios

import axios from 'axios';

async makeRequest() {
  try {
    const response = await axios.post('your_request_url_here', {
    // Enter your body parameters here
    });
  }
  catch(e) {
    // Handle your error here
  }
}

// Axios returns a promise and hence you can use .then(), .catch for error
// handling if you don't want to use async/await(use try/catch for error 
// handling)
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #post #request #axios
ADD COMMENT
Topic
Name
3+3 =