I'm looking to write a custom library in node and I'd like to include that with my Cloud Functions. Since this is shared code, I'd like to be able to use it across all my Cloud Functions.
What's the best way to write a library of shared code and have that accessed by multiple Cloud Functions.
For example, say I have two Cloud Functions, functionA and functionB.
I have a node javascript file called "common.js" that has a javascript function that I'd like to expose to both functionA and functionB.
exports.common = {
log: function(message) {
console.log('COMMON: ' + message);
}
};
So in functionA I'd like to require this file and call "common.log('test');".
I see this as the most basic of questions but I honestly can't find an answer anywhere.
Any help would be most appreciated. This is literally the ONLY thing preventing me from using GCF as the way I develop code now and into the future!