| Viewed 247 times

how to create a server in Nodejs

how to create a server in Nodejs

1 Answer
Mohammad Qandeel

First, you need to install Nodejs from official website

then you need to create a new file  myServer.js

after that, you need to add this snippet code to the previous file 

var http = require('http');

	res.writeHead(200,{'Content-Type': 'text/html'});
	res.write("Server Run");


now  you need to run this code in the command line 

$ node myServer.js

then you can access your browser at http://localhost:801/

you will see the result Server Run


Related Questions