Root folder should install concurrently
and nodemon
in devDependencies
npm install --save-dev nodemon concurrently
Run in root folder termial npx create-react-app client
(creat your frontend react app)
and add scripts :
{
”client” : ”npm start -prefix client”,
“dev” : ”concurrently \”npm run server\” \”npm run client\””
}
(If your frontend folder name is [client] )
Copy:
"scripts": {
"start": "node server",
"server": "nodemon server",
"client": "npm start -prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
In package, json (root folder’s)
testing( npm run dev ) In root folder, it should be work
delete “READEME.md” and “.gitignore”
in client folder, terminal “rm -rf .git”
// Do or not do up to you (Just convient for dev to request,axios, cut some string)
In client folder “pakage.json” add
(If backend port number is [5000] )
“proxy” : “http://localhost:5000”
“http://127.0.0.1:5000” (same)
Copy:
"proxy":"http://localhost:5000”,
or
"proxy": "http://127.0.0.1:5000",
for setting pop browser, I already set environment variable to Microsoft edge, so no need to add.
( // "start": "BROWSER='Microsoft Edge' react-scripts start",
)