9
Jestem noobem Nodes.js i staram się opanować konstrukcje modułów. Do tej pory mam moduł (testMod.js) zdefiniowane tej klasy konstrukt:Moduł eksportuje klasę Nodes.js
var testModule = {
input : "",
testFunc : function() {
return "You said: " + input;
}
}
exports.test = testModule;
próbuję wywołać metodę testFunc() wygląda następująco:
var test = require("testMod");
test.input = "Hello World";
console.log(test.testFunc);
Ale otrzymuję TypeError:
TypeError: Object #<Object> has no method 'test'
Co robię źle robię?
Niesamowite dziękuję. – travega