Guys, I read the previous thread, and seems like I am not the only one having Moralis API call issues.
I completed youtube Moralis tutorials where we used Moralis API to fetch data from smart contract and show on front-end. So my app also works fine on localhost, but after creating production build and uploading to guthub and then to Internet, Moralis API calls disappear.
I went further and checked the console. It kept saying ‘axios’ issue. Well, then I looked at front-end App.js folder and indeed found the following:
async function getNameAndBalance() {
const res = await axios.get(`http://localhost:3001/getNameAndBalance`, {
params: { userAddress: address },
})
so, it looks like axios is looking for localhost/3001 but since I am on Internet so he cant find any localhost and thats why is throwing an error…
Do you guys have any ideas about how I can change it? or what exactly should I change here. what code should I write to make axios work properly?
Unfortunately nothing about this has been mentioned in the video:(
Hope the dude from previous thread sees this and if mine gets fixed probably his will fix too.
thanks for help