Node.js is a very powerful JavaScript-based framework/platform built on Google Chrome’s JavaScript V8 Engine which makes it possible to run Javascript on the server side.
It is used to develop I/O intensive web applications like video streaming sites, single-page applications, and other web applications. It is awesome for real time stuff for example if we use PHP for this then it is not good for this because it consumes a lot of memory.
Using NPM — a tool that makes installing and managing Node modules — it’s quite easy to add many useful tools to your web development toolkit.
Node.js is open source, completely free, and used by thousands of developers around the world.
Node.js lets developers write JavaScript for both client and server side, thereby making it easy to send data between the server and the client to synchronize the data automatically.
The data changes on the server immediately reflect in the client and the webpage that displays this data automatically updates itself.
Contents
1. Installation
- Download Node js Windows installer (.msi) from node js website.
- Run the installer.
- Follow the installer.
- At last, click on Install button.
- It takes a couple of minutes and clicks on Finish button.
2. Testing
After Node.js installation is time to test that Node.js working correctly or not. For this open Command prompt check the version of a node by typing node -v
and for checking npm version type npm -v
.
3. Update
The process to update Node.js on Windows is almost the same as the process to install Node.js on Windows.
Basically, you run the .msi installer. You can directly update by downloading the installer and run it.
It replaces the previous version and updates to new version.
4. Hello World
The first node script print "Hello World!"
text in the console when running it. Open your favorite editor and type the following code –
console.log("Hello World!");
And save it as hellowworld.js
.
Open command prompts and navigates to save directory and type node helloworld.js
.