I am new to Node and JS, trying to implement a module. Inside my module I want to have an object, that I can initialize instances of it in other methods of my module (specifically in my case its a response object). So my code is:
exports.myModule = {
//response object
Response: function()
{
// some initializing and functions
function testFunction(){
console.log("test function inside object was called");
}
}
//now i am trying to create an instance
tester: function() {
var res = new Response();
res.testFunction();
}
}
However I am getting syntax errors that I do not understand (this code doesn't make sense to its purpose, since I am still testing basic creation of the object In my module,
EDITED
Now when creating a new response I get the error: ReferenceError: response is not defined
Responselike. You could do something like:module.exports = {...}and then reference the module. Its very garish in all honesty. Ill provide an answer and see if you like it