I got this code, where I am trying to fetch the data from database and it works on local host:
async function getLikedAnimations(username) {
const res = await fetch(`http://localhost:8080/animation-list/?username=${username}`);
const json = await res.json();
const likedAnimations = json.animationList;
return likedAnimations;
}
How can I replace localhost with process.env.PORT or is there any other way, I tried this:
async function getLikedAnimations(username) {
const res = await fetch(`${process.env.PORT}/animation-list/?username=${username}`);
const json = await res.json();
const likedAnimations = json.animationList;
return likedAnimations;
}
And it's not working
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…