How do I pass command line arguments to a Node.js program?

后端 未结 30 3165
梦如初夏
梦如初夏 2020-11-22 04:03

I have a web server written in Node.js and I would like to launch with a specific folder. I\'m not sure how to access arguments in JavaScript. I\'m running node like this:

30条回答
  •  深忆病人
    2020-11-22 04:27

    It's probably a good idea to manage your configuration in a centralized manner using something like nconf https://github.com/flatiron/nconf

    It helps you work with configuration files, environment variables, command-line arguments.

提交回复
热议问题