Advertisement
thieumao

NodeJs - Count

Jan 23rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const http = require('http');
  2.  
  3. var count = 0
  4.  
  5. http.createServer( function(request, response) {
  6.   console.log('Hello World' + count);
  7.   count++;
  8.   console.log(request.url);
  9.   response.writeHead(200, {'Content-Type' : 'text/html'});
  10.   // response.end('<h1>Count ' + count + '</h1>');
  11.   response.end( JSON.stringify({name: 'Mao', age: 25}), null, 4 );
  12. } ).listen(3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement