I have to create the frontend for an application. Someone else created the backend using node. I have always created my projects using create-react-app, however, since the backend is already created, including modules, routes, db, etc, I couldn't use this command to create the project, so I installed all my packages independently. This is my package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build-css": "node-sass-chokidar client/ -o client/",
"watch-css": "npm run build-css && node-sass-chokidar client/ -o client/ --watch --recursive",
"start-js": "react-scripts start",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"start": "npm-run-all -p start-node watch-css start-js",
"start-node": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.16.2",
"body-parser": "^1.18.2",
"bulma": "^0.6.0",
"express": "^4.16.2",
"mongoose": "^4.12.3",
"morgan": "^1.9.0",
"q": "^1.4.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "^1.0.14"
},
"devDependencies": {
"node-sass-chokidar": "0.0.3",
"npm-run-all": "^4.1.1",
"sass": "^1.0.0-beta.2"
}
}
There's a problem with the start-js since node is already runnin on port 3000 and react needs to run as well. How can I make both run concurrently?