you need to cd into your root directory or where both client and server folders are and npm install, npm init, git init, touch gitignore and add /node_modules
In your package.json in your root directory add this:
"client": "cd client && npm start",
"backend": "cd server && nodemon server.js",
"dev": "concurrently "npm run backend" "npm run client"",
In your server directory, npm install and touch gitignore /nodemodules
In your package.json add this:
"scripts": {
"start": "node server.js",
"server": "nodemon server.js"
},
In your client folder, npm install and touch gitignore /node_modules
In your package.json add this:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
Then you can always run your app and server by just cd into your main directory, and doing npm run dev.
Btw: Its hard to deploy servers to heroku when they are separated into a folder and they aren't in a root directory.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…