DEV Community

Cover image for Why learn Node.js and where NPM lies in all this

Posted on

Why learn Node.js and where NPM lies in all this


Node.js, as the official site says is a JavaScript runtime built on Chrome's V8 JavaScript Engine. That means JavaScript as a language is not just limited to frontend web development but you can stretch it to write code on the server-side. 😃😄

To be a web developer 💻, it is a recommended path to learn HTML, CSS, and JavaScript. As soon as one learns the frontend web by making a project on a framework like React or Angular, to make a full project one used to learn backend technologies like Java, Python, or Ruby. That means learning another language for the other half which can be troublesome being a newbie. Node gives frontend developers to see the other side, the backend development and you don't have to learn new language and rules in the process. 👨‍💻👩‍💻

If you are not a web developer 🤦‍♂️🤦‍♀️ also and getting your hands dirty for learning frontend skills, you are anyway learning JavaScript. Node.js is a popular runtime for JavaScript lets you widen your backend and JavaScript knowledge. 😝😜

But it doesn't matter in the long run if you started with Node, Python, or Java. What matters is the principles and the rules that need to be taken care of. The technology aims to solve real-life problems and every technology has its advantages and disadvantages based on the business problem that is solving. 🏡

Let's discuss how we can use Node on the terminal.

  1. We can directly interact with the node console. First, install Node. Then type, "node" and enter. It will let you execute javascript.
Welcome to Node.js v14.6.0.
Type ".help" for more information.
> 2+3
> "hello "+ "world"
'hello world'
  1. Or, run a file having JavaScript's line of code. this is an effective way of executing JavaScript as all the code can be written in a file and can be executed by passing "node ".
C:\Users\user_name>node app.js


According to, NPM is the number 1️⃣ reason why developers like node.js. NPM stands for Node Package Manager, which contains libraries created by other developers on Node and can be used by us. A framework for backend is available Express is an example of how it can be helpful. Like express, mongoose, faker there are more than 350k freely available packages and we can use that for building cool stuff. 😍😍😍

The use of these packages is to eliminate the pains of a developer by using code that has been written by someone else on Node. The command npm install is used to install any package. After installing a package we can include that in our application by using require()

//Add a package to the existing project

C:\Users\user_name\DemoProject>npm install express

//Using express into our code

var express = require("express");  //including express to our app
var app = express();     //assigning it to a variable as express contains lot of functions.

Top comments (0)