Created
February 14, 2021 09:26
-
-
Save arashmad/30059c8e52d150d91ab25e186bab7045 to your computer and use it in GitHub Desktop.
build react-node-express project using yarn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In React JS project go to package.json | |
// Inside the 'scripts' block, change | |
"start":"react-scripts start" | |
// to | |
"start":"react-scripts build && (cd backend && yarn start)", | |
// in which, backen is the root directory of node-express app | |
// and add | |
"start-client": "react-scripts start", //starts react app on port=3000 | |
// now in node-express root directory, open server.js (maybe app.js) | |
// make this changes | |
const path = require('path'); | |
app.use(express.static(path.join(__dirname, "..", "build"))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment