axios data vs body code example
Example 1: axios post
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Example 2: axios vs request
axios.post('http://pokeapi.co/api/v2/pokemon/', { pokemon: 'Pikachu', }) .then((response) => { return response; }) .catch((error) => { console.log(error); });