building a nodejs api that calls other api athorization header middleware axios code example
Example 1: axios default headers authorization
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
Example 2: axios defaults headers common
axios.get('/user?ID=12345')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});