NodeJS is one of the most popular server side (& client side) JavaScript framework to create robust, fast, scalable applications. It supports an event-driven (see wiki) approach, and has flexible non-blocking I/O models that make it easy to support a wide range of data-intensive apps running across different platforms or devices.
Here I am going to share how to get it installed, running and creating a first 'Hello World' app.
NodeJS Installation
Once Node has been installed , open the command prompt and type ' node ' as shown below
This shows that Node has been installed successfully.
Lets create a basic Hello World app.
Here I am going to share how to get it installed, running and creating a first 'Hello World' app.
NodeJS Installation
- Download an appropriate binary from http://nodejs.org/#download
- If you are using Windows then by downloading and installing execuatble version will work
- For other platform, read this guide https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
Once Node has been installed , open the command prompt and type ' node ' as shown below
This shows that Node has been installed successfully.
Lets create a basic Hello World app.
- Create a JavaScript file in any folder on your machine
- Copy below code
console.log("Hello World");
console.log ( "Hello World".length );
- Open command in that location and run this command node filename.js
- It will execute the JavaScript code in the filename.js file and will show results on screen
As you can see, it executed JavaScript script and as per the first line of the script it shown the Hello World and on the second line we have used a JavaScript string length property to find the length of an string.
In the next tutorial, I will explain how to create a running http server to serve http requests. (either coming from desktop browser or mobile device).