So I created a post previous day and deleted it because it's unproper and also unclear, so right now, I'll try to write it properly.
So I created a MERN app using render.com, but the problem is every time I refresh the the webpage, I get an error / not found
. Example. I went to a specific user id , I can view his the profile but once I refresh/reload, it gets an error. So I created a two separate folder and two different GitHub repo.
I uploaded the front end as a static website in render.com
Github: Front Site
Website Front Website
So for the backend, I follow this thread and Why deployed create-react-app returns 404 error upon reload?. But I don't know how can I properly use res.sendFile
because I'm using a different root directory as well as different github repo.
Github : https://github.com/cruz-emman/back
Website: https://mern-tua-ebenta.onrender.com/
I tried to use this, and I admit that I'm doing it wrong because I don't know how can I do it.
app.use(express.static(path.join(__dirname,'../client/build')));
app.get('*', (req,res) => res.sendFile(path.resolve(__dirname,'../', 'client','build','index.html'))
EDIT: TYPO