A basic structure for a project in Nodejs.
- NodeJS 14.16.xx
- NPM 7.6.xx
- Yarn 1.22.x
yarn install
yarn start
200 Request
- ok
yarn test
or
yarn --watchAll
yarn build
Use pm2
yarn global add pm2
pm2 start dist/bundle.js --name basic-structure-project-nodejs-service
pm2 restart basic-structure-project-nodejs-service
pm2 reload basic-structure-project-nodejs-service
pm2 stop basic-structure-project-nodejs-service
pm2 delete basic-structure-project-nodejs-service
pm2 list
pm2 logs
pm2 monit
For Node.js applications, PM2 includes an automatic load balancer that will share all HTTP[s]/Websocket/TCP/UDP connections between each spawned processes.
pm2 start app.bundle.js --name basic-structure-project-nodejs-service -i max
pm2 startup