I have an express app where inside it has a create-react-app. when the user goes to root url I want to show the index.html present in create-react-app public folder. Here is my code for index.js in express app
const express = require("express");
const app = express();
app.get('/',function(req,res){
});
const PORT = process.env.PORT || 5000;
app.listen(PORT);
Here is my project directory

You need this line: app.use(express.static('public')). See here: https://expressjs.com/en/starter/static-files.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With