How to create an app in Node.js

Last few days back I have worked on Node.js. So I would like to explain in this post about how to create an app in Node.js.

What is Node.js:

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
Source :

How to create an app in Node.js by Anil Kumar Panigrahi

How to create an app in Node.js by Anil Kumar Panigrahi


We have discussed it earlier Foundation front-end framework installation

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
download link for How to create an app in Node.js by Anil Kumar Panigrahi


1. Create application folder eg: SampleApp
2. Create a package.json


  "name": "SampleApp",
  "description": "SampleApp using Node.js",
  "version": "0.0.1",
  "private": true,
  "main": "app.js",
  "dependencies": {
    "express": "4.9.5"

dependencies – list of modules used in this application

Create a file with .js extension

eg: app.js

app.js code:

var express = require('express');

var app = express();

app.get('/', function (req, res) {
  res.status(200).send('Welcome to Anil Labs first node.js sample application!');

// Start the server
var server = app.listen(3000,function(){
 console.log("Listening to port %s",server.address().port);

Run the application:

cd SampleApp
npm install
node app.js

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

2 Responses

  1. August 30, 2016

    […] the earlier post, created the node.js sample application. Now we will learn how to deploy node.js application to Heroku. Installation process I have checked […]

  2. December 28, 2018

    […] I have explained how to create Node.js and how to deploy. Now for React.js We need to run the below command to create an […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.