Download: WebM (10 MB) MP4 (22 MB)
Episode 3: Modules
Modules are the building blocks of Node.js applications. Find out how to use them and how to create your own.
Links
Module Demonstration
circle.js
var pi = 3.14;
exports.circumference = function(radius) {
return radius * radius * pi;
};
exports.area = function(radius) {
return 2 * radius * pi;
};
app.js
var circle = require('./circle');
var radius = 1;
console.log("Circ. with radius = 1:", circle.circumference(radius));
console.log("Area with radius = 1:", circle.area(radius));
Log in to add your comment!

thx
This definitely can be a huge impact on the budding Nodejs community. Keep up the great work!