post axios express 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 post request
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});