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; |
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
/** | |
* Gets driving directions from Mountain View to San Francisco. | |
* Derived from https://github.com/googleworkspace/apps-script-samples/blob/main/sheets/maps/maps.gs | |
* @customfunction | |
*/ | |
function getDrivingDirections() { | |
// Set starting and ending addresses | |
var start = '1600 Amphitheatre Pkwy, Mountain View, CA 94043'; | |
var end = '345 Spear St, San Francisco, CA 94105'; | |
var directions = Maps.newDirectionFinder().setOrigin(start).setDestination(end).getDirections(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Google Docs API Quickstart</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<p>Google Docs API Quickstart</p> | |
<!--Add buttons to initiate auth sequence and sign out--> | |
<button id="authorize_button" style="display: none;">Authorize</button> |
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
{ | |
"main": "index.js", | |
"dependencies": { | |
"@google-cloud/functions-framework": "^2.1.0" | |
}, | |
"watch": { | |
"start": "*.js" | |
}, | |
"devDependencies": { | |
"npm-watch": "^0.11.0" |
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
{ | |
"main": "index.js", | |
"dependencies": { | |
"@google-cloud/functions-framework": "^2.1.0" | |
}, | |
"scripts": { | |
"start": "npx @google-cloud/functions-framework --target=helloWorld" | |
} | |
} |
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
const FunctionsFramework = require('@google-cloud/functions-framework'); | |
FunctionsFramework.http('helloWorld', (req, res) => { | |
res.send('Hot-reload me?'); | |
}); |
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
{ | |
"name": "nodejs-ff-esm", | |
"type": "module", | |
"engines": { | |
"node": ">=12.0.0" | |
}, | |
"scripts": { | |
"start": "functions-framework --target=esm" | |
}, | |
"dependencies": { |
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
> npm start | |
> nodejs-docs-samples-esm@0.0.1 start /Users/timmerman/Documents/github/googlecloudplatform/functions-framework-nodejs/docs/esm | |
> functions-framework --target=esm | |
Serving function... | |
Function: esm | |
Signature type: http | |
URL: http://localhost:8080/ |
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
export function esm(req, res) { | |
res.send(`Hello, ${MY_CONST}!`); | |
}; |
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
import {MY_CONST} from './consts.js'; |
NewerOlder