pm2-node-argv
v1.1.1
Published
pm2, node, npm script args
Downloads
39
Readme
pm2-node-argv
Get pm2, node, npm inject arguments
Install
Using npm:
npm install pm2-node-argv
or using yarn:
yarn add pm2-node-argv
How to Use ?
Pm2
Inject arguments:
pm2 start xxx.js -- --port=5005 --name=lucas
Get arguments:
const { getArgv } = require('pm2-node-argv')
const obj = getArgv();
console.log('obj', obj)
// {
// "port": 5005,
// "name": lucas
// }
Node
Inject arguments:
node xxx.js -- --port=5005 --name=lucas
Get arguments:
const { getArgv } = require('pm2-node-argv')
const obj = getArgv();
console.log('obj', obj)
// {
// "port": 5005,
// "name": lucas
// }
Npm
Inject arguments:
pm2 start xxx.js -- --port=5005 --name=lucas
Get arguments:
const { getArgv } = require('pm2-node-argv')
const obj = getArgv();
console.log('obj', obj)
// {
// "port": 5005,
// "name": lucas
// }
npm start xxx -- --port=5005 --name=lucas