Node.js http output HTML to client
var http = require('http'); var server = http.createServer(function (request, response) { console.log("HTTP works!"); response.writeHead(200, {"Content-Type": "text/html"}); response.write("<!DOCTYPE html>"); response.write("<html>"); response.write("<head>"); response.write("<title>Hello World Page</title>"); response.write("</head>"); response.write("<body>"); response.write("Hello World!"); response.write("</body>"); response.write("</html>"); response.end();// w w w. ja v a 2s . c o m }); server.listen(8080); console.log('Server is listened port:8080');