So I have been tasked with getting to grips with Node.js for work, and as my background being a C# developer, this shouldn’t be to hard.
This post outlines just the very basics from a tutorial I found on learning node.js, and outlines the environment setup and writing a simple console output of Hello World.
I am now running a Mac as my main workstation, a MacBook Pro – top of the line system (thanks to work – I love my work), and will list out the process I went through to get Node.js running.
- Navigated to: https://nodejs.org/en/download/
- Downloaded the relevant installer, as I am using a Mac now, I will outline what I did Mac wise. (I downloaded the Mac OS X Installer Package.
- Ran the installer and went through the licensing agreement etc…
- Install == done!
Now for the Hello Word application in Node.js!
On my Mac I am running NetBeans 8.1, and there is direct support in NetBeans for JavaScript files. So the main editor I will be using moving forward will be NetBeans rather than Eclipse or any other text editor (I haven’t used Eclipse in a long time so am not ‘not recommending Eclipse’).
Here are the steps I took from the tutorial I did to run the Hello World application:
- So my first task was to create a new file named helloworld.js
- In the new file write the following code:
console.log("Hello World");
- Next we need to execute the code, and this is done by the following command:node helloworld.js
Note. To get this to work I launched terminal on my Mac and then navigated to the folder where I placed my script and then ran the command in the terminal.The output of this should be:
Hello World