What is Node Js

Node.js is a JavaScript-based platform built on Google Chrome’s JavaScript V8 Engine. Node.js allows us to run JavaScript on the server.

Create a file name app.js and paste below code like below screenshot

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Maxester!');
}).listen(8000);

After this run below command
node app

screenshot below

After run above command open you browser and run the below URL

http://localhost:8000/

Output come like this

If this comes then your node js sample code working fine on your system.
If you still face issue please cross check with the installation of Node Js on your system.

Leave a Reply

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