Wednesday, September 21, 2022

Node server backend for React App

cat /etc/hosts

http://localhost:3001/ === http://127.0.0.1:3001/

run react and node servers in parallel on UNIX => & as separator in react-app/package.json

"scripts": {
"start": "react-scripts start & nodemon node src/server.js",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},

npm init -y // if install new empty project

npm i dotenv // in existing project

npm i express // in existing project

sudo npm i nodemon -g // automatically restarts node server after change

npm list -g // global install === -g

/usr/local/lib

├── eslint@8.22.0

├── live-server@1.2.2

├── node-sass@7.0.1

├── nodemon@2.0.20

└── npm-run-all@4.1.5

https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel

https://towardsdev.com/how-to-set-up-a-node-js-express-server-for-react-c19104568d12

https://www.freecodecamp.org/news/how-to-create-a-react-app-with-a-node-backend-the-complete-guide/

https://www.geeksforgeeks.org/how-to-connect-node-js-with-react-js/

No comments:

Post a Comment