This is a Starter template for react and node application
Install both node and react dependencies with following npm command
npm run install-all
- First it installs node modules for server
- change directory to client
- Installs node modules for client
To run a development version of this application run the following npm command (Both fronend and backend)
npm run start-mon
concurrently --names "Server,client" -c "bgGreen.bold,bgBlue.bold" "nodemon server/src/index.js" "cd client && npm start"
- Uses concurently package to run server and client at the same time
- --names "Server,client" names for our process
- -c "bgGreen.bold,bgBlue.bold" colors to differentiate
- "nodemon server/src/index.js" "cd client && npm start" commands to run in concurently
To start the server without fronend
npm run dev
- starts server with nodemon
To run a production version of this application first run the build command which will generate a publish folder in root
npm run build
- Changes to client directory
- Runs npm run build inside client to generate publish folder in parent (i.e same level as server)
The following command build the frontend applocation and creates a deploy folder and deploy.zip in parent folder (app level)
npm run build-deploy
- Changes to client directory
- Runs npm run build inside client to generate publish folder in parent (i.e same level as server)
- changes to parent directory (server)
- runs create-zip custom script to generate deploy folder and deploy.zip in parent filder ( same level as app)
To start the application after build is done run the following command
npm start
The folowing scripts and commands are not directly used by user but they are used by our main scripts
To run a task in gulpfile which will create a deploy folder and generates deploy.zip
npm run create-zip
-
Executes gulp createDeploy command to run createDeploy task
-
Gulpfile contains the above script to perform the operations