NodeJS Learning minutes 1st

Posted on Thu 05 March 2015 in Programming

Simplest Echo Server

codes:

var net = require('net')

var server = net.createServer(function(socket) {
        socket.on('data', function(data) {
                socket.write(data)
        });
});

socket.listen(8888)

Event Emitter 事件发射器

codes:

var EventEmitter = require('events').EventEmitter
var channel = new EventEmitter();
channel.on('join', function() {
        console.log('bind join with the function');
})
channel.emit('join');

create a restful web app by nodejs

Reference

Getting the Code

Checkout depot tools, and run:

fetch v8

This will checkout V8 into the directory v8 and fetch all of its dependencies. To stay up to date, run:

git pull origin
gclient sync