Possible Duplicate:
What is the purpose of NodeJS module.exports and how do you use it?
I have the following code:
var express = require('express');
var app = module.exports= express();
require('./config/environment.js')(app, express, __dirname);
require('./routes/default.js')(app, __dirname);
module.exports = function (app, express, dirname) {
....
};
module.exports = function (app, dirname) {
....
};
what happened in this code. Second string says, that module.exports and app are the same object, right?
but in function(...) parts app pass as parameter and that code likes on "to object 'module' add method 'exports' and do it 2 times" I want to add some functions, which want to use inside each function (...), but can't because don't understand what happens in that constructions. Thanks