Node.js

Preview:

DESCRIPTION

node.js

Citation preview

Node.js Easy, Scaleable and Fast

The new cool kid in town

Java, Php, Rails and now Node.js

So, Why Node?

Cause Its fast

Fast mean

Event-Driven Non-Blocking I/O

Lightweight Efficient

Cause Its cool

Cool mean

Everyone to use it so its super easy to find people who will want to join you

Scalable

Node.js is the perfect solution for perfect for data-intensive real-time applications that run across distributed devices.

an example (CallBack)

result = query( "select smurfs from some_mushroom" ); // twiddle fingers

go_do_something_with_result( result );

query( statement: "select smurfs from some_mushroom", callback: go_do_something_with_result() );

an example (Events)

var events = require('events'); var eventEmitter = new events.EventEmitter();

var ringBell = function ringBell()

{ console.log('ring ring ring');

} eventEmitter.on('doorOpen', ringBell);

eventEmitter.emit('doorOpen');

an example (Events)

why we want to use event 1. dry 2. organize 3. callback 4. readable