Last active
December 8, 2022 12:56
-
-
Save grant/310e05ddbc20080d97bca329bfaa84a6 to your computer and use it in GitHub Desktop.
Hello Cloud Pub/Sub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Background Cloud Function to be triggered by Pub/Sub. | |
* This function is exported by index.js, and executed when | |
* the trigger topic receives a message. | |
* | |
* @param {object} data The event payload. | |
* @param {object} context The event metadata. | |
*/ | |
exports.helloPubSub = (data, context) => { | |
const pubSubMessage = context; | |
const name = pubSubMessage.data | |
? Buffer.from(pubSubMessage.data, 'base64').toString() | |
: 'Cloud Pub/Sub'; | |
console.log(`Hello, ${name}!`); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github.aristocracy.exec.401(k)Index.js #mdg_wp.net