It's quite common when running an application to want to pass arguments to the program to define how it should run when executed. This is no different then with Node.js. To accomplish this I like to use one of two ways:

  1. Reading the array process.argv and manually parsing the variables

  2. Using an npm library such as minimist that helps simplify and (in my opinion) parses them into a nice JavaScript variable

Let's take a look at both ways.