Learning by examples.
First of all make sure you have downloaded and installed node.js before getting started with this tutorial.
Hello word node.js application.
res.end('Hello World !');
How to run above code
First save the file as .js file.Mine I saved as firstscript.js.
Open the command prompt and open the folder that contains the script file.
Once you have opened type “node filename.js”.
See below screenshot.
Open your browser and type “localhost:8080”
Below screen should appear with Hello world.
Running node.js in command line interface.
Some of the node.js results are better displayed on the command line.Using console.log() function,you can display the results in the command prompt.
console.log("This is Console output");
If you a new node.js developer you will face one problem of restarting your script whenever you make changes.There are several options that you can use to automatically reload your script whenever you hit the save button.