4
3

More than 5 years have passed since last update.

pm2でnodeの引数を渡して起動する

Last updated at Posted at 2014-12-17

通常起動

$ node app.js hikisu

引数の取り方

console.log(process.arg[2]);

/*->hikisu*/

PM2でデーモン起動する場合

$ pm2 start app.js --node-args="引数"

となるので

$ pm2 start app.js --node-args="app.js hikisu"

とすればOKです。

4
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3