Node.js http server with delay

Description

Node.js http server with delay


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

server=http.createServer(function(req,res){
  res.writeHead(200, {'Content-Type':'text/plain'});
  res.write('Hello\r\n');

  setTimeout(function(){
    res.end('World\r\n');
  }, 2000);/*from  w  w  w  .j  av a  2s  . c  o m*/
});
server.listen(8000);



PreviousNext

Related