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",
)