Currently, I'm trying to fetch data from node.js to react.js. And I'm using useEffect to get the data from node.js but for some reason, I can not get the URL from node js. I'm really new to node.js with react.js So I want to know what is a proper way to fetch the data. This is my code:
Server
const app = express();
var client_id =
"???????????????????????????????????????";
var client_secret =
"???????????????????????????????????????";
var state_val = "RANDOM_STATE";
var redirectURI = "http://localhost:5000/callback";
app.get("/", function (req, res) {
let api_url =
"https://www.?????.co.kr/oauth2.0/authorize?response_type=code&client_id=" +
client_id +
"&redirect_uri=" +
redirectURI +
"&state=" +
state_val;
res.send("<a href='" + api_url + "'>로그인</a>");
});
Client
const [d, setd] = useState();
useEffect(() => {
fetch("http://localhost:5000/")
.then(res => {
return res.send();
})
.then(data => {
console.log(data);
setd(data);
});
}, []);
console.log(d);
And when I access this, I got an error like this:

but when I change the fetch Url like "http://localhost:5000/callback" then it doesn't get the error