I've been trying to get a response from a REST API through Axios, I've tried setting the headers up, specifically the Access-Control-Allow-Origin header as stated in the error message, which seems to be the main problem, because even as I insert the required header, it still doesn't acknowledge the header.
axios
.get(url, {
headers: {
"Access-Control-Allow-Origin": "*",
crossDomain: true,
"Content-Type": "text/plain;charset=utf-8",
},
params: {
access_key: API_KEY,
adults: adults,
origin: origin,
destination: destination,
departure: departure,
},
})
.then((res) => {
console.log(res.data);
});