Node.js http create server on by port and local host

Description

Node.js http create server on by port and local host

var http = require('http');

var server = http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
});/* www  .  j  a va 2 s. c  o m*/

server.listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');



PreviousNext

Related