Getting started with NodeJs

Purti Aggarwal
Jun 20 · 5 min read
Image for post
Image for post
  1. Installation of NodeJS and NPM.
  2. Installation of VS Code.
  3. Basic project setup with express.
  4. Hello World” with NodeJs

What is NodeJs?

NodeJs is a free open source server that allows us to run Javascript on the server. With the help of NodeJs, we can create, open, read, write, delete, and close files on the server. We can generate dynamic websites and add delete our data from the database.

  1. Node Package Manager (NPM)
  2. IDE (Integrated Development Environment) or TextEditor

NodeJs Module Types:

NodeJs includes three types of modules:

1. Core Modules:

The Core Modules are those modules that coded into the binary distribution and loaded whenever the NodeJs process starts. However, we need to import the module to use the module in your application.

2. Local Modules:

The Local Modules are those modules that we create locally for the application project. In other words, we can say the different functions that we created for the different functions of the application project.

3. Third-Party Modules:

The Third-Party Modules are those modules that can be downloaded through the npm. These modules are created by someone else but we can use it in our project.

Let’s start building the project.

Step-1: Download the required tools

First, we download the NodeJs from the given link

$ node -v

Step-2: Creating the directory

First, we have to make the base folder in which we have all the project related directories. An example we made the application folder.

Image for post
Image for post
File Structure

Step-3: Installing the express module

To use NodeJs NPM modules, you first to install the module in the terminal using below command

$ npm i express

Step-4: Import the Module

Now we have to load the module in our project (index.js file).

const express = require('express');const app = express();

Step-5: Listen to the Port

Now we have to bind and listen for connections on the specified host and port.

const port = process.env.PORT || 3000
app.listen(port, () => {
console.log('Server is up to ' + port)

Step-6: Route the request

Now we send the request to the server

app.get('/', (req, res) => {
req.send('Hello World');
$ node index.js
Image for post
Image for post
The result after the server is up


In this blog, we learned about NodeJs and it’s the express framework. First, we have set up the file structure then we see the module installation and how to route the request to the server. NodeJs has owns a huge world. We can do many things with NodeJs like make the Authenticate the website. The dataBase can be linked to the backend where we can save the data of the registered users and many other things. Hopefully, this article helps you with getting started with the NodeJs.

For more learning, you should go through the link

Image for post
Image for post


This publication contains all the major blogs that are on…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store