In this video we are going to learn how to build react application so that we can deploy it to node server step by step in hindi. Building React App to deploy | Preparing react app for hosting on node server in Hindi




const express = require("express");
const app = express();

// serve up production assets

// let the react app to handle any unknown routes
// serve up the index.html if express does'nt recognize the route
const path = require("path");
app.get("*", (req, res) => {
  res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));

// if not in production use the port 5000
const PORT = process.env.PORT || 5000;

console.log("server started on port:", PORT);