Search code examples
node.jsreactjsexpressmern

Hosted Front-end Unable to Access Hosted Backend, but Local Front-end is Able to Access Hosted Back-end


I have created a MERN chat-app and am facing a few problems. Everything works fine, locally. The problems only start when I host my project, which are as follows: I am unable to access the hosted backend from my hosted frontend. The weird part is that if I am running the frontend locally (and calling the hosted backend), it works fine (except for the socket.io part, which obviously can only be accessed with permission). When I use a proxy, I get a 404 error, and when I don't, I get a cors error. I also tried installing the cors package, but that again gave a 404 error. Please tell me where am I messing up. Thanks in advance!

Back-end

https://chatter-backend-90rs.onrender.com

https://github.com/DenzilJD/chatter-backend

Front-end

https://chatterdjd.netlify.app/

https://github.com/DenzilJD/chatter


Solution

  • Your signup API hitting this URL :

    enter image description here

    Your signup API should this URL : enter image description here