Part of becoming a MEAN Stack hero is brandishing your weapons at a moment's notice. Node.js from command line is just such a weapon. In order to do that you should have already installed Node.js and have the ability to create a javascript application that will be transpiled by Node.js for execution.
This specific quest is going to require that you create a javascript Node.js script that outputs "Hello World".
Make sure you've got Node.js installed. Open a new command window, or, use the integrated terminal
within
your IDE. Test whether node.js is installed by typing/running:
$ node --version
v9.11.1
Next, let's write a very simple Node.js script. Make sure you're in the root directory of your project and create a file with the following contents:
console.log('Hello MongoDB World 2018!');
Now we can test it by running it with the node
command:
Kens-MacBook-Pro-3:getting-mean kenalger$ node helloworld.js
Hello MongoDB World 2018!
You're on your way to becoming a hero. Jump to Quest 3 if you're up for
- Executing Node.js from command line.
None.
Quest | Description | |
---|---|---|
Quest Zero | First quest to read. Provides some overview information and background. | |
Quest 1 | Initialize your project and install some of the required software. | |
> | Quest 2 | creating a quick test JavaScript. |
Quest 3 | Crafting your own tools: Building a server process using httpd and express |
|
Quest 4 | Building Your App | |
Quest 5 | Defining the data for our application | |
Quest 6 | Enter MongoDB - Native JavaScript | |
Quest 7 | Creating and Reading data using the Native MongoDB Driver | |
Quest 8 | Mongoose - Object Data Modeling | |
Quest 9 | Creating and Reading data using Mongoose |
Next quest: Quest 3 - Crafting your own tools: Building a server process using httpd
and express