Regarding this question: What is the purpose of Node.js module.exports and how do you use it?
I’m a Javascript beginner. In the referenced question…
mymodule.js code
var myFunc = function() { ... };
exports.myFunc = myFunc;
main js file
var m = require('./mymodule.js');
m.myFunc();
Is mymodule essentially a class file defining objects?
Node.js allows code to be separated into different modules. This modules are just javascript files that can expose functions or objects using the
exportsobject.There are no Classes in JavaScript but you can use patterns to emulate that behaviour. There is a question about implementing OOP patterns in JavaScript: what pattern to use when creating javascript class?
As a beginner there are very good books for JavaScript:
They are short and will give you a very good insight of the JavaScript Language.