Skip to content

Instantly share code, notes, and snippets.

@gquental
Created August 30, 2012 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gquental/3521436 to your computer and use it in GitHub Desktop.
Save gquental/3521436 to your computer and use it in GitHub Desktop.
CW35 Hack Thursday - NodeJS - CommonJS
var text1 = 'Testando';
var obj = {test: 'Testando'};
var testFunction = function () {
console.log('oi');
}
exports.text1 = text1;
exports.obj = obj;
exports.testFunction = testFunction;
var text1 = require('./commonjs1').text1;
var obj = require('./commonjs1').obj;
var testFunction = require('./commonjs1').testFunction;
console.log(text1);
console.log(obj);
testFunction();
var Testing = function () {
this.init();
}
Testing.prototype.init = function () {
console.log('testando classe');
}
module.exports = new Testing();
var testing = require('./commonjs3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment