My app returning 404 errors

Hi. The landing page works fine and making backend requests on there works. However when I route to /stays or any other route that does backend query, I get a 404 not found page

My web service region is Ohio and it’s a new account. Front end is Reactjs and backend is Nodejs

For starters, I’m seeing this in the logs:
Error: ENOENT: no such file or directory, stat ‘/opt/render/project/src/client/build/index.html’

This is how my static use looks like and I think the error is coming from here:
app.use(express.static(“client/build”));

app.get(“*”, (req, res) => {

res.sendFile(path.resolve(__dirname, “client”, “build”, “index.html”))

})

Also I have attached a photo of my folder structure

Hi,

If you’re referring to 404s on the frontend, maybe you haven’t implemented the rewrite for the React Router?

Docs: https://render.com/docs/deploy-create-react-app#using-client-side-routing

Alan

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.