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';
}

Comments

Popular posts from this blog

Project euler 169 found clue

Floyd-Warshall's algorithm