score:1

Accepted answer

first create build folder in react side by running

npm run build

then add these lines of code in the node side in app.js/index.js

app.use(express.static("<your_react_app_folder>/build"));
if (process.env.node_env === "production") {
  const path = require("path");
  app.get("/*", (req, res) => {
    res.sendfile(path, resolve(__dirname, "../<your_react_app_folder>", "build", "index.html"));
  });
}

then deploy it to heroku/remote server.

note: remember to remove /build line from .gitignore file


Related Query

More Query from same tag