What is Node.js and Why it is used?
Node.js is famous for the non-blocking, asynchronous and network programming. Node.js is a popular choice to create web server these days for the responsive UI websites.
3 Building Blocks of Node.js
“Node” is comprised of three building blocks.
- A cross-platform and event-driven IO library called as “Lib UV” which was actually built to port Node.js to Windows environment. It replace many Unix specific libraries so that it is compatible with Window environment.
Is Node.js used for frontend or backend?
Is Node.js easier than Java?
Getting Started with Node.js
You can get Node.js in various ways. You can download the installers from nodejs.org and install using its wizard which takes care of installation and configuring the environment variables etc., or else, you can directly download the binaries also, and configure the environment variables etc., correctly. If you would like to build it on yourself, then you can also download the source code from its repository.
You can also make use of a tool called “NVM” developed by Tim Caswell. Using nvm you can clone different versions of Node.js from its GitHub. You can use nvm to install and manage multiple Node.js versions. It is extremely helpful as it allows us to test our code with multiple Node versions.
Once you clone nvm, we can use “nvm install” and specifying the version number to install specific Node version. After installation, you can switch between different Node versions using “nvm use” command. You can also set 1 particular version as the default one by using the command “nvm alias default”.