Most Popular Tutorials
Most Popular Tutorials :-

Simply Easy Learning at Your Fingertips. Click Tutorials Menu to view More Tutorial List





How to run node.js application on localhost server?

How to Run NodeJs Application?

Install NodeJs

File Name :

  • Download and install node.Js

  • check node is install or not

    File Name :

  • C:\Users\hp>node --version OR node --v
  • C:\Users\hp>npm --version OR npm --v

  • install ExpressJs

    File Name :

  • create your node project
  • c:\> mkdir mynode
  • c:\> cd mynode
  • c:\mynode> npm install express
    ########## OR ###########
    npm install express --save
  • npm install body-parser --save
  • npm install cookie-parser --save
  • npm install multer --save

  • create myapp.js

    File Name : myapp.js

    const express = require('express')
    const app = express()
    app.get('/', function (req, res) {
    res.send('Hello Sana Mahtab')
    })
    app.listen(3000)



  • Open command prompt OR terminal in VS Code
  • C:\mynode> node myapp.js
  • open browser :- http://localhost:3000/
  • Hello Sana Mahtab

  • Example

    File Name : myapp.js

    const express = require('express')
    const app = express()
    console.log("Hi Mahira Mahtab")
    app.get('/', function (req, res) {

    res.send('Hello Sana')

    })
    app.listen(3000)

    Run :-

    File Name :

    C:\mynode> node myapp.js

    open browser and type the URL :- localhost:3000

    See the result on browser :- Hello Sana


    How to stop server :-

    C:\mynode> node myapp.js

  • To stop the server from running, you simply press Ctrl+C.
  • clean up everything and shut down properly. To debug, just add the debug flag before the name of your program:
    node debug app.js





  • Previous Next


    Trending Tutorials




    Review & Rating

    0.0 / 5

    0 Review

    5
    (0)

    4
    (0)

    3
    (0)

    2
    (0)

    1
    (0)

    Write Review Here