0

I have a React App and I use a server.js file for a Contact Form. Now my question is: In the code below what should be changed before deploying? Because my app is listening to port 5000.

const express = require("epxress");
const router = express.Router();
const cors = require("cors");
const nodemailer = require("nodemailer");

const app = express();
app.use(cors());
app.use(express.json());
app.use("/", router);
app.listen(5000, () => console.log("Server: Running"));

What should I replace that 5000 with before I deploy the app? (with Netlify if it is important)

  • You can take port from env, for example:- process.env.PORT || 5000. Reference:- https://stackoverflow.com/a/18864718/11256012 – Ronak Jan 24 '23 at 19:29

0 Answers0