I have another problem with node.js, this time I cannot get javascript code to find out that the coffeescript module class has functions.
In my main main.js file, I have the following code:
require('./node_modules/coffee-script/lib/coffee-script/coffee-script'); var Utils = require('./test'); console.log(typeof Utils); console.log(Utils); console.log(typeof Utils.myFunction);
And in my test.coffe module, I have the following code:
class MyModule myFunction : () -> console.log("debugging hello world!") module.exports = MyModule
Here is the result when I run node main.js :
function [Function: MyModule] undefined
My question is: why does my main file load the correct module, but why can't it access this function? What am I doing wrong, whether with coffeescript syntax or with how I need my module? Let me know if I clarify my question.
Thanks,
Vineet
source share