In order to run the app in development mode for pm2 cluster, do the following:
- Open 2 node terminals
- On the first one, run
npm run pm2-all-cluster-dev - On the second one, run
npm run watch:pm2 - That's all, it'll clean the dist folder and create a new one and also when any changes occur in the system it'll stop the current instance(s), clean the dist folder again, create a new one and reload the instance(s).
In order to run the app in production mode for pm2 cluster, do the following:
- Run new build and zip the app, dist-app, env, .gitignore, .npmrc, credentials.json, package.json, package-lock.json, README.md and token.json
- Select from the list of package scripts and run
pm2-all-clusterorpm2-all-cluster-max(for max cores) - That's all.
npx kill-port
<port number here>On new files upload, no need to run the scripts again, it'll auto reload when it detects changes.
The following scripts are available in the package.json:
start: Runs the application in production mode.build: Cleans thedist-appdirectory and transpiles the source code.server: Starts the server from the transpiled code.dev: Runs the application in development mode, including building and starting the server.prod: Builds the application and starts the server in production mode.transpile: Transpiles the source code using Babel.clean: Removes thedist-appdirectory.watch:dev: Starts the application in development mode with file watching usingnodemon.test: Placeholder for running tests (currently not implemented).
To get started, clone the repository and install the dependencies:
git clone <repository-url>
cd drippo-lifestyle-api
npm installTo run the application in development mode:
npm run devTo build and run the application in production mode:
npm run prodTo clean the build directory and transpile the source code:
npm run buildTo start the application in development mode with file watching:
npm run watch:dev