Aprendizagem do Nó Ch1

App Hello World básico

// Require HTTP Module from native Node Platform
var http = require('http');

// Create HTTP server with simple callback
// 200 means the request has succeeded.
// Specify the Mime type so the browser understands what it is dealing with
// Write the response data
// End the response

http
.createServer(function(request,response){
response
.writeHead(200, {'Content-Type':'text/plain'});
response
.write('Hello Worldn');
response
.end();
});

// Tell the server to start with the port 3000
server
.listen(3000);

// Log out to the terminal for the user to go to the correct address
console
.log('Server running at http://localhost:300');