Have tried everything to connect my React frontend to my express backend (MongoDB). When I run nodemon server and go to URL "http://localhost:5000/api/projects/" I get full json list of data. When I fetch the same link in the frontend I get the errors: Failed to load resource:
net::ERR_CONNECTION_REFUSED** & **TypeError: Failed to fetch.
I've seen this issue linked often but have tried the suggested solutions including checking CORS is enabled and the API link is correct. Neither have worked.
fetch("https://localhost:5000/api/projects/", {
method: "GET",
})
.then((res) => console.log(res.data))
.catch((e) => {
console.error(e)
})