myfirst.js
var http = require("http");
var firstModule = require("./myfirstExportModule");
http.createServer(function(req, res){
res.writeHead(200, {'content-Type':'text/html'});
res.write('first name on console. ');
firstModule.firstname("name");
res.end('');
}).listen(3000);
console.log("listening on port 3000...");
myfirstExportModule.js
function firstname(name){
console.log('<br>first Name is: '+name);
}
module.exports = {
firstname:firstname
}
I am getting two output on console as follows
first Name is: Name
first Name is: Name
Can anyone explain why?