-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCF: Add Node 8 background function samples #779
Conversation
functions/node8/index.js
Outdated
* @returns {Promise} | ||
*/ | ||
exports.helloPromise = (data) => { | ||
const request = require('request-promise'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this outside of the function, and use two region tag blocks? e.g:
// [START tag_name]
const library = require('library');
// [END tag_name]
...
// [START tag_name]
exports.useLibrary = () => {
...
}
// [END tag_name]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I copied this from the original Node 6 sample though: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/functions/background/index.js#L47-L53
Should that one be changed as well?
Also - can you add (unit) tests, or should I do that? |
@ace-n Can you add unit tests? I can't get the tests running locally. |
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made edits + added tests. LGTM to me if it does to you.
Looks good to me, thanks! |
🤖 I have created a release *beep* *boop* --- ## [7.0.0](googleapis/nodejs-translate@v6.3.1...v7.0.0) (2022-06-30) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#789) ### Features * support regapic LRO ([#798](googleapis/nodejs-translate#798)) ([9f1ddc1](googleapis/nodejs-translate@9f1ddc1)) ### Bug Fixes * **deps:** update dependency @google-cloud/common to v4 ([#793](googleapis/nodejs-translate#793)) ([a2d079b](googleapis/nodejs-translate@a2d079b)) * **test:** fix language detection test ([#779](googleapis/nodejs-translate#779)) ([b6df5e2](googleapis/nodejs-translate@b6df5e2)) ### Build System * update library to use Node 12 ([#789](googleapis/nodejs-translate#789)) ([3060301](googleapis/nodejs-translate@3060301)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [7.0.0](googleapis/nodejs-translate@v6.3.1...v7.0.0) (2022-06-30) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#789) ### Features * support regapic LRO ([#798](googleapis/nodejs-translate#798)) ([9f1ddc1](googleapis/nodejs-translate@9f1ddc1)) ### Bug Fixes * **deps:** update dependency @google-cloud/common to v4 ([#793](googleapis/nodejs-translate#793)) ([a2d079b](googleapis/nodejs-translate@a2d079b)) * **test:** fix language detection test ([#779](googleapis/nodejs-translate#779)) ([b6df5e2](googleapis/nodejs-translate@b6df5e2)) ### Build System * update library to use Node 12 ([#789](googleapis/nodejs-translate#789)) ([3060301](googleapis/nodejs-translate@3060301)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [7.0.0](googleapis/nodejs-translate@v6.3.1...v7.0.0) (2022-06-30) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#789) ### Features * support regapic LRO ([#798](googleapis/nodejs-translate#798)) ([9f1ddc1](googleapis/nodejs-translate@9f1ddc1)) ### Bug Fixes * **deps:** update dependency @google-cloud/common to v4 ([#793](googleapis/nodejs-translate#793)) ([a2d079b](googleapis/nodejs-translate@a2d079b)) * **test:** fix language detection test ([#779](googleapis/nodejs-translate#779)) ([b6df5e2](googleapis/nodejs-translate@b6df5e2)) ### Build System * update library to use Node 12 ([#789](googleapis/nodejs-translate#789)) ([3060301](googleapis/nodejs-translate@3060301)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [7.0.0](googleapis/nodejs-translate@v6.3.1...v7.0.0) (2022-06-30) ### ⚠ BREAKING CHANGES * update library to use Node 12 (#789) ### Features * support regapic LRO ([#798](googleapis/nodejs-translate#798)) ([9f1ddc1](googleapis/nodejs-translate@9f1ddc1)) ### Bug Fixes * **deps:** update dependency @google-cloud/common to v4 ([#793](googleapis/nodejs-translate#793)) ([a2d079b](googleapis/nodejs-translate@a2d079b)) * **test:** fix language detection test ([#779](googleapis/nodejs-translate#779)) ([b6df5e2](googleapis/nodejs-translate@b6df5e2)) ### Build System * update library to use Node 12 ([#789](googleapis/nodejs-translate#789)) ([3060301](googleapis/nodejs-translate@3060301)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [7.0.0](googleapis/nodejs-translate@v6.3.1...v7.0.0) (2022-06-30) ### ⚠ BREAKING CHANGES * update library to use Node 12 (GoogleCloudPlatform#789) ### Features * support regapic LRO ([GoogleCloudPlatform#798](googleapis/nodejs-translate#798)) ([9f1ddc1](googleapis/nodejs-translate@9f1ddc1)) ### Bug Fixes * **deps:** update dependency @google-cloud/common to v4 ([GoogleCloudPlatform#793](googleapis/nodejs-translate#793)) ([a2d079b](googleapis/nodejs-translate@a2d079b)) * **test:** fix language detection test ([GoogleCloudPlatform#779](googleapis/nodejs-translate#779)) ([b6df5e2](googleapis/nodejs-translate@b6df5e2)) ### Build System * update library to use Node 12 ([GoogleCloudPlatform#789](googleapis/nodejs-translate#789)) ([3060301](googleapis/nodejs-translate@3060301)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Adding
helloPromise
andhelloSynchronous
samples for Node 8 to illustrate returning a Promise and a synchronously returning a result.