The Axios API Reference
Requests can be made by passing the relevant config to axios
.
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
// GET request for remote image in node.js
axios({
method: 'get',
url: 'http://bit.ly/2mTM3nY',
responseType: 'stream'
})
.then(function (response) {
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
});
// Send a GET request (default method)
axios('/user/12345');
For convenience aliases have been provided for all supported request methods.
When using the alias methods url
, method
, and data
properties don't need to be specified in config.
© 2011-2022 Kenneth Reitz and other contributors
Licensed under the Apache license.
https://axios-http.com/docs/api_intro