My deployed MERN app, can't retrieve data from the backend service on other devices

Viewed 147

I have a MERN app that is running on Heroku, and it works perfectly on my laptop, but when I run it on my phone or other devices, only the frontend (React.js) is working, the backend service (Node.js) not being called to retrieve data from the database.

how can I fix this issue?

1 Answers

Ok, I fixed it on my own.

I am posting the answer in case anyone needs it.

You need to put the middlewares in server.js in the following order.

screenshot of the original code

Related