|Getting Started with Node.js|
|Written by Ian Elliot|
|Thursday, 12 October 2017|
Page 1 of 2
A Programmers Guide To Languages
It doesn't make sense and the reasons for it are more a matter of history than any logic.
There are also some other facts about Node.js that are worth knowing, in particular that it implements an event-oriented way of organizing the server, but these can wait until you have found out a little more about how it all works.
First you need to download and install Node.js. This is just a matter or finding the Node.js web site
and downloading an installer.
If you are running Linux of any description, follow the instructions about installing using a package manager.
If you are running Windows or Mac then simply use the installer you will find at Download.
Before the latest version of Node.js it was more difficult to get it working under Windows but now you can simply use the installer and expect it to all work without you haven't to install anything else first.
From this point on I'm going to be describing how the Windows version works but the other installations work in more or less the same way with slight changes in directories where the files are stored etc.
After installing Node.js the actual server and other executables are stored in Program Files/nodejs, but you don't have to make use of this information because the installer adds this to your execution path.
If you prefer an IDE then NetBeans offers to create a Node.js project for you and this has some advantages.
You can start a NetBeans Node.js project before or after you have installed Node.js. All you have to do is tell NetBeans where node.exe is stored. If NetBeans doesn't know it will display a dialog window asking you to resolve the problem:
A Simpler Hello World
To get started let's create the simplest program possible, and it is much simpler than the Hello World you will find in the documentation:
Next open a command prompt and change the current directory to the one you saved Hello.js in - you should be able to see it when you type Dir. Finally enter the command:
You will see
printed on the next line. If you don't see the message then you need to check that Node.js was installed and that the files are all where you thought you stored them.
If you are using Netbeans then you can simply run the program and see the output in the console.
|Last Updated ( Thursday, 12 October 2017 )|