How to run your react app inside your server directory?
Cd to your main directory
Rename your index.js to server.js
In your package.json rename all occurences of index to server
Type the following command create-react-app client
Cd client
Create a .env file and add the following line SKIP_PREFLIGHT_CHECK=true
Delete node_modules and package-lock.json IN YOUR CLIENT DIRECTORY ONLY
Cd back to your server directory and add the following to your package.json
"scripts" : {
"client-install" : "npm install --prefix client" ,
"start" : "node server" ,
"server" : "nodemon server" ,
"test" : "jest" ,
"client" : "npm start --prefix client" ,
"dev" : "concurrently \"npm run server\" \"npm run client\""
} ,
Type the following in your terminal npm i concurrently --save
Type the following in your terminal npm i
Type the following in your terminal npm run client-install
Type the following in your terminal npm run dev
By now, you should see that your server is running and that your react app is running