I have a MERN stack currently deployed on heroku and I am trying to migrate it to render. The backend uses Node and the frontend uses React. The backend uses node on localhost:5000 and interacts with the frontend on localhost:3000. How can I achieve the same thing on render. I have currently deployed the front end as a static website and the backend as a web service but cant seem to establish communication. I am definitely missing something here, I will appreciate if somebody can guide me or point me in the right direction
Hi John,
Thanks for reaching out.
This sounds similar to a post I replied to yesterday, the applicable part being:
The usual implementation with the set-up you described would be a Web Service backend/API that connects to MongoDB and the static frontend makes calls to your backend. For example, a React Static Site on
my-frontend-123.onrender.com
would make client-side JS calls tomy-backend-123.onrender.com
, where the backend can query MongoDB directly and return the data to the frontend.
So the backend deployed to a Web Service and the Frontend deployed to a Static Site. And you’d configure the frontend to make client-side JS requests to the backend.
It comes down to your own implementation, but that would be a common pattern.
Alan
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.