leafsummer
7/7/2015 - 10:04 AM

nodejs, create a simple http server

nodejs, create a simple http server

var http = require('http');

http.createServer(function(req, res){
  res.wirteHead(200, {'Content-Type': 'text/html'});
  res.wirte('<h1>Node.js</h1>');
  res.end('<p>Hello World</p>');
}).listen(3000);
console.log("HTTP Server is lisetening at port 3000.");