Node.js http create server and listen to port 8000

Description

Node.js http create server and listen to port 8000


var http=require('http'), server;

server=http.createServer(function(req,res){
  res.writeHead(200, {'Content-Type':'text/plain'});
  res.write('Hello\r\n');
  res.end('World\r\n');
});/*ww w  .j  ava 2 s .  c om*/
server.listen(8000);



PreviousNext

Related