pm2-node-argv

1.1.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i pm2-node-argv

Weekly Downloads

26

Version

1.1.1

License

ISC

Unpacked Size

1.78 kB

Total Files

3

Last publish

Collaborators

  • lucaswangdev