Skip to content

Instantly share code, notes, and snippets.

@auchomage
Created July 12, 2016 13:49
Show Gist options
  • Save auchomage/e066ac4d5660b81ebfecc195bc084846 to your computer and use it in GitHub Desktop.
Save auchomage/e066ac4d5660b81ebfecc195bc084846 to your computer and use it in GitHub Desktop.
Using module.exports in node.js
// make data available to decon_t1_callingFile.js
module.exports = function(){
console.log('Output from file decon_t1calledFile.js');
};
// get input from file called 'decon_t1_calledFile.js'
var someInput = require('./decon_t1_calledFile.js');
// display contents of someInput
someInput();
@auchomage
Copy link
Author

This works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment