Creating Hello World Application In Node.js

hello world in node.js

Here, we will learn to create Node.js with simple hello world application.

Run or Execute this JavaScript File:

  1. Open Visual Studio Code IDE. If you are unfamiliar with this, you can go to this tutorial: Setup and Install Node.js
  2. Create a file named hello_world.js
  3. Write the code like as shown below.
    console.log('hello world');
  4. To execute to program open terminal.
  5. Type: “node (hello_world)” into the terminal.


hello world in node.js

You can also execute to run this Node.js Application:

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end('Hello World!');
  1. Start your internet browser, and type in the address: http://localhost:8080
  2. Now, your computer works as a server! If anyone tries to access your computer on port 8080, they will get a “Hello World!” message in return!

How to Download & Install Node.js - NPM on Windows

Check out this video tutorial below:


Sharing is caring!

Facebook Comments

Leave a Reply