Axios is a lightweight HTTP client based on the XMLHttpRequests
service. It is similar to the Fetch API and is used to perform HTTP requests.
The following command can be used for installing axios using npm:
npm install axios
Axios can be used to perform a simple GET
request. The syntax for this is:
axios({
url:'https://www.educative.io/',
method: 'get'
})
Axios can similarly be used to perform a simple POST
request. We can also send parameters in an object using the POST
request. The syntax for this is:
axios({
method: 'post',
url: '/signup',
data: {
user: 'abcd1234',
pass: 'pwd1234'
}
})
Free Resources