Node-Js Full Topic
Node-Js Full Topic
NODE.JS
TOMASZ PAWLAK, PHD
MARCIN SZUBERT, PHD
INSTITUTE OF COMPUTING SCIENCE, POZNAN UNIVERSITY OF TECHNOLOGY
PRESENTATION OUTLINE
• What is Node.js?
• Design of Node.js
• Modules
• What is Node.js?
• Design of Node.js
• Modules
• What is Node.js?
• Design of Node.js
• Modules
return {
incrementCounter: function () {
return counter++;
},
resetCounter: function () {
console.log( "counter value prior to reset: " + counter );
counter = 0;
}
};
})();
//math.js
exports.add = function() {
var sum = 0, i = 0, args = arguments, l = args.length;
while (i < l) {
sum += args[i++];
}
return sum;
};
//increment.js
var add = require('math').add;
exports.increment = function(val) {
return add(val, 1);
};
//program.js
var inc = require('increment').increment;
var a = 1;
console.log(inc(a)); // 2
MODULES IN NODE.JS
• What is Node.js?
• Design of Node.js
• Modules
});
RESTIFY
• Restify is a Node.js module built specifically to enable
you to build correct / strict REST web services that
are maintanable and observable.
• It intentionally borrows heavily from express as that is
more or less the de facto API for writing web
applications on top of node.js.
• Express' use case is targeted at browser applications
and contains a lot of functionality, such as templating
and rendering, to support that. Restify does not.
• Restify gives control over interactions with HTTP and
full observability into the latency and the other
characteristics of the applications — automatic DTrace
support for all your handlers.
SAILS.JS
function* idMaker(){
var index = 0;
while(index < 3)
yield index++;
}
console.log(gen.next().value); // 0
console.log(gen.next().value); // 1
console.log(gen.next().value); // 2
console.log(gen.next().value); // undefined
PRESENTATION OUTLINE
• What is Node.js?
• Design of Node.js
• Modules
• Browserify starts at the entry point files that you give it and
searches for any require() calls it finds using static
analysis of the source code's abstract syntax tree.
• http://jsbooks.revolunet.com
• http://javascript.crockford.com