How can I export all the modules and variables present in a Javascript file using NodeJS. Suppose i have a .js file with 20 functions and 20 variables and i need to export all of the functions and variables at once and not one by one. How can i achieve this?
You can't. You must explicitly name them, in some way.
If Amberlamps' answer is not possible (you want them at the base level), you could still do:
module.exports = {
functionA: function () {
// TODO
},
functionB: function () {
// TODO
},
// the rest
};
How about this:
exports.MyApp = {
functionA: function() {
// TODO
},
functionB: function() {
// TODO
}
};