Receiving command-line arguments with Optimist


show more Receiving command-line arguments with Optimist provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013) show less
please wait ...

Receiving command-line arguments with Optimist

Every time we've run a Node program, we've done it from the command line. It will be very convenient to be able to configure our program, as we run it by specifying some command line arguments. Node provides tools we can use to do that. In this video, we'll write some code accepting command line arguments. First let's go to the Exercise Files and set up the project. Go to chapter 8 and video 3, and then Copy the Start folder onto the Desktop. Next go to Terminal, and change directory to that folder.

I'm just going to drag it in to get the path. Then press Return, and then type npm space install. And also follow that by Return. So once that's complete, open up the Start folder in your Text Editor, and first let's go to server.js. Now Node is already keeping track of what's being entered on the command line, and it's actually pretty easy to get to. Let's see what Node keeps track of. Type in console log and then process.argv. So now, let's go to terminal and st...

Receiving command-line arguments with Optimist
Video duration: 6m 14s 3h 17m Intermediate

Viewers:

Receiving command-line arguments with Optimist provides you with in-depth training on Developer. Taught by Joseph LeBlanc as part of the Node.js Essential Training (2013)

Subject:
Developer
Software:
JavaScript Node.js
Author:
please wait ...