Node.JS 
Javascript no lado do Servidor

         Mauricio Vieira

                           Salvador, 28 de abril de 2012
Sobre mim
   /mauriciovieira
   @mauriciovieira
   /mbcvieira
http://mauriciovieira.net


      Omni ignotum pro magnifico
http://linguagil.com.br
      Agosto/2012
http://nodejs.org
JavaScript → código nativo
Objetos em cache
Coletor de lixo stop-the-world


  http://code.google.com/p/v8
Reactor Pattern
Perl AnyEvent
Python Twisted
Ruby EventMachine
Erlang


       Javascript
setTimeout(function() {
  console.log('World!');
}, 2000);
console.log('Hello');
    var fs = require('fs');

     fs.stat('/etc/passwd', function(err, stats) {
       if (err) {console.log(err.message); return; }
       console.log(stats);
       //console.log('this file is ' + stats.size + ' bytes
       long.');
     });
The Way of Node



  http://bit.ly/A3bObP
The Way of Node

  1. Node is a platform
timers, process, util, events, Buffer,
Stream, Crypto, TLS/SSL, fs, path,
Net, UDP, dns, HTTP(S), tty, zlib, os.
http://commonjs.org
92672795




http://npmjs.org
The Way of Node

2. Node is JavaScript

 (but JavaScript is not Node)
The Way of Node

 3. Node is callbacks
 & Streams
(standard callback API and Streams)
http://socket.io
http://faye.jcoglan.com/
http://pubsub.io/
The Way of Node
4. Node is not pretending
to be blocking when it
is not.
The Way of Node
5. Node is not going to
include that module.
The Way of Node
6. Node is for building.

   (not a science experiment
   or academic research)
http://expressjs.com/
http://geddyjs.org/
http://railwayjs.com/
http://flatironjs.org/
The Way of Node
7. Node is a community.
http://mashable.com/2011/03/10/node-js/
The Way of Node
8. Node is faster.

   (Node is never fast enough)
The Way of Node
9. Node is fun.

        Obviously!
http://nodeknockout.com/
Observer         Permite
                 observar o
                 que os
                 usuários
                 fazem em
                 tempo real !



   http://observer.no.de/
Eight Bit Beats

Collaborative,
social beat
and melody
sequencer.



 http://youtu.be/QmtB9o4HBQU
Driv.in               Time
                      brasileiro!

                      Drive in
                      virtual :-)




          http://driv.in/
Doodle or die
Players
create chains
of alternating
drawings and
captions with
hilarious
results.

     http://doodleordie.com/
ACROnode.com
                 Criação de
                 backronimos.




     http://driv.in/
GPU lava

Usa a
biblioteca
node-webgl
feita durante
as 48 horas
de concurso.

    http://minimason.no.de/
Chess@HomeProjeto a la
                      SETI@home
                      para
                      destronar o
                      maior
                      computador
                      de Xadrez


http://joshfire.nko2.nodeknockout.com/
Mais exemplos
https://gomockingbird.com/
http://codestre.am
Obrigado!
   /mauriciovieira
   @mauriciovieira
   /mbcvieira
http://mauriciovieira.net


      Omni ignotum pro magnifico

Node js javascript no lado do servidor