I am using a weather api to retrieve data however I am getting a 404. I am using postman as an api client and everything is returning ok. I am just wondering if I am implementing it wrong in my code…?
const getUserLocation = () => {
let location = navigator.geolocation.getCurrentPosition((position) => {
let longitude = position.coords.longitude;
longitude = Math.round(longitude);
let latitude = position.coords.latitude;
latitude = Math.round(latitude);
let apiKey = "thisisnotmykey";
fetch(
`api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longitude}&appid=${apiKey}`
).then((res) => {
console.log(res);
});
});
};
Everything is coming back to postman fine with all the info I need however, it is throwing a 404 error in my browser…?