Node.js Scripting_language

Getting Started with Node.js

Node.js is a server-side platform built on Google Chrome’s JavaScript Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009

Node.js has an event-driven architecture capable of asynchronous I/O

A package manager was introduced for the Node.js environment called npm. The package manager makes it easier for programmers to publish and share source code of Node.js libraries and is designed to simplify installation, updating, and un-installation of libraries

Node.js File

Node.js files contain tasks that will be executed on certain events

A typical event is someone trying to access a port on the server

Node.js files must be initiated on the server before having any effect

Node.js files have extension “.js”

Uses Node.js

Following are the areas where Node.js is proving itself as a perfect technology partner.

I/O bound Applications

Data Streaming Applications

Data Intensive Real-time Applications (DIRT)

JSON APIs based Applications

Single Page Applications


Not to Use Node.js

It is not advisable to use Node.js for CPU intensive applications.

Getting Started

Install from here

After installation using cmd mode check the version

Create a folder in folder explorer


Note: If any downloaded project need to restore the defined packages we need to run packages with version

npm install express –save

npm->  install-> modulename-> version (if any) -> we can use –save  or –no–save


Go to console/cmd mode

npm init (pass the inputs)

provide the inputs like name / version if any dependency  and finally it will create package.json


  "name": "aadicsdemo",

  "version": "1.0.0",

  "description": "NodejsConsoleApp",

  "main": "app.js",

  "author": "Rupesh",

  "scripts": {

    "test": "node"


  "license": "ISC"


Add app.js file

Which contains (Copy paste )

'use strict';

console.log('Hello world');

//Basic call modules

const http = require('http');

//Define the host name

const hostname = '';

//Define the port name

const port = 3000;

const server = http.createServer((req, res) =>


    res.statusCode = 200;//If get success show the status code

    res.setHeader('Content-Type', 'text/plain');

    res.end('Hello World\n');


//Print with ip/port details to browse on web

server.listen(port, hostname, () =>


    console.log(`Server running at http://${hostname}:${port}/`);


Run the command

>node app.js

On console

Now open on browser


Note : We can create using some of the  IDE like  CLI/Visual Studio Code/ Visual Studio /Notepade++  e.t.c.

You Might Also Like...

No Comments

    Leave a Reply