Skip to content

Commit 11a4b46

Browse files
ddegrafAce Nassri
authored and
Ace Nassri
committed
chore(functions/concepts): Migrate afterResponse sample to gen2
1 parent aa8f79b commit 11a4b46

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

functions/concepts/afterResponse/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@
1515
'use strict';
1616

1717
// [START functions_concepts_after_response]
18+
const functions = require('@google-cloud/functions-framework');
19+
1820
/**
1921
* HTTP Cloud Function that may not completely
2022
* execute due to early HTTP response
2123
*
2224
* @param {Object} req Cloud Function request context.
2325
* @param {Object} res Cloud Function response context.
2426
*/
25-
exports.afterResponse = (req, res) => {
27+
functions.http('afterResponse', (req, res) => {
2628
res.end();
2729

2830
// This statement may not execute
2931
console.log('Function complete!');
30-
};
32+
});
3133
// [END functions_concepts_after_response]

functions/concepts/afterResponse/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
},
1111
"engines": {
1212
"node": ">=12.0.0"
13+
},
14+
"dependencies": {
15+
"@google-cloud/functions-framework": "^3.1.3"
1316
}
1417
}

0 commit comments

Comments
 (0)