Take a look of advantages
JavaScript
Using JavaScript on a web server
as well as the browser
No data validation between
server and client
People already know it
JavaScript
Event-driven development
Node.js uses an event-driven, non-blocking I/O model, which makes it lightweight.
Async code
No multithreading, deadlocks, etc.
Node.js keeps a single thread
for your code...
Event-driven development
Extremily fast
V8 Google Engine
Optimized for hight concurrent
environments.
Extremily fast
npm
Huge community with tons
of great libraries
Warning!
CONS
Five versions of everything
npm
How to install?
Ubuntu
Setup with Ubuntu:
curl --silent --location
https://deb.nodesource.com/setup_4.x
 | sudo bash -
          
Then install
sudo apt-get install --yes nodejs
          
Fedora
Official Fedora Node.js and npm packages are available in Fedora 18 and later. Install with:
sudo yum install nodejs npm
          
      
Windows
How to install?
npm must-have modules
Asynchronous Pattern Module
Step
Futures
Async
Web Framework
Express
jQuery
Bootstrap
Testing
JSHint
Mocha
Vows
npm must-have modules
Install package global
npm install http-server -g
        
Install package local
npm install http-server
        
Examples
Command promt
echo
for(i = 2; i < process.argv.length; i++){
  process.stdout.write(process.argv[i]);
  process.stdout.write(" ");
}
process.stdout.write('\n');
Asynchronous
var results = [];
setTimeout(function() {
  console.log("Task 1");
  results[0] = 1;
  setTimeout(function() {
    console.log("Task 2");
    results[1] = 2;
    setTimeout(function() {
      console.log("Task 3");
      results[2] = 3;
    }, 10000);
  }, 800);
}, 100);
HTTP Server
// Include http module.
var http = require("http");
// Create the server.
http.createServer(function(request, response) {
  // Write headers to the response.
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World from server");
  //End of response
  response.end();
}).listen(8888);
File I/O
var http = require("http"),
// And file system module
fs = require("fs");
http.createServer(function (request, response) {
	// Check if user requests /
	if (request.url == '/') {
		// Read the file.
		fs.readFile('test.txt', 'utf-8', function (error, data) {
			// Write headers.
			response.writeHead(200, {
				'Content-Type': 'text/plain'
			});
			// Increment the number obtained from file.
			data = parseInt(data) + 1;
			// Write incremented number to file.
			fs.writeFile('test.txt', data);
			// End response with some nice message.
			response.end('This page was refreshed ' + data +
       ' times!');
		});
	} else {
		// Indicate that requested file was not found.
		response.writeHead(404);
		// And end request without sending any data.
		response.end();
	}
}).listen(8888);
Examples
Questions?
Overview