Hello Developers,
In this tutorial, I will show you an easy way to run Hello World
on the Node server.
To run anything in the Node server first we need to download Node on our local computer from the link below:
Node.Js Download Link: www.nodejs.org/en/
After downloading and installing it we have to follow some steps:
http
module in the http
variablecreateServer()
methodlisten()
method in a port
var http = require('http');
var server = http.createServer(function(request, response){
response.end('Hello World');
});
server.listen('5050');
console.log('Server Running Successfully');
Then run the below command in the terminal to execute the file.
node main.js
We will find "Server Running Successfully" in the terminal. Hit the below line in the browser:
http://localhost:5050
This might help you in the journey of development.