Reputation: 507
get(function (){
console.log(' Hello world');
});
I have this js file that contains some message in a project folder in my node eclipse. I want access that js file to my current project folder using path. How to access that file to my current folder. Please give me the code for both js files for accessing and exporting. Please help me. Thank you
Upvotes: 0
Views: 1121
Reputation: 1249
Try this:
// common.js
module.exports = {
theFunc: function(obj){
console.log(' Hello world');
};
}
// another.js
var common = require('common.js'); // with full path
common.theFunc();
Upvotes: 2