Create HTTP Server in Node JS
In this example, We will show simple program about, Hows to create http server in node js. This example has been tested and shared in the same post.
Example Program
var http = require("http"); var server = http.createServer(function(req, res) { res.writeHead(200, {"Content-Type": "text/html"}); res.write("<!DOCTYPE 'html'>"); res.write("<html>"); res.write("<head>"); res.write("<title>Creating Server in Node JS</title>"); res.write("</head>"); res.write("<body>"); res.write("<h1>Hello everyone! welcome to dineshkrish.com</h1>"); res.write("</body>"); res.write("</html>"); res.end(); }); server.listen(8081); console.log("Application is running at http://localhost:8081");
Run it
More from my site

Hello, folks, I am a founder of idineshkrishnan.com. I love open source technologies, If you find my tutorials are useful, please consider making donations to these charities.
No responses yet