My Blog List

Wednesday, August 27, 2014

exports in nodejs

Require and Exports ~!

require will get file

exports will help file to be used in require file


example


main.js
var mymodule = require('./mymodule.js');

console.log('asdfasdf ' + mymodule.hello());

mymodule.js
exports.hello = function(){
return 'hello 2';
}

No comments:

Post a Comment