I have read tons of responses on this error but none of the causes seem to be my problem.
The endpoint works fine if I hit it directly. When I tested this on my local (localhost) machine I have the same issue.
Here is frontend code.
async function getAirportInfo(){
let icao = document.getElementById('icao').value
var data = await fetch(airportfeed + icao, {
method: "GET",
mode: "no-cors",
headers: {
'Content-Type': 'application/json'
}
});
let response = await data.json()
console.log(response)
document.getElementById("airportname").value = response.name
}
Here is the endpoint code:
app.get("/airports/:icao", async function(req, res) {
let reqicao = req.params.icao
await getAirportRecord(reqicao)
res.set({
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*"
});
res.send(airportresults);
});
Some other interesting information that may help you help me is that when I check the Network log on the browser the request to the endpoint appears to have completed successfully:
But on the Response tab I see this:
I am not sure what the issue is.
Please help.