This is the next question In Node.js, how do I enable “include” functions from my other files?
I would like to include an external js file containing common functions for the Node.js application.
From one of the answers in Node.js, how do I enable the “include” functions from my other files? this can be done with
module.exports = {
foo: function () {
},
bar: function () {
}
};
var zemba = function () {
}
Inconvenient to export each function. Is it possible to have a one-line mechanism that exports all functions? Something like this:
module.exports = 'all functions';
It is much more convenient. It is also less buggy if you later cannot export certain functions.
, , ? js , . - include <stdio.h> C/++.