UNPKG

firebase-tools

Version:
26 lines (20 loc) 926 B
/* * This template contains a HTTP function that responds with a greeting when called * * Always use the FUNCTIONS HANDLER NAMESPACE * when writing Cloud Functions for extensions. * Learn more about the handler namespace in the docs * * Reference PARAMETERS in your functions code with: * `process.env.<parameter-name>` * Learn more about parameters in the docs */ import * as functions from 'firebase-functions'; exports.greetTheWorld = functions.handler.https.onRequest((req, res) => { // Here we reference a user-provided parameter (its value is provided by the user during installation) const consumerProvidedGreeting = process.env.GREETING; // And here we reference an auto-populated parameter (its value is provided by Firebase after installation) const instanceId = process.env.EXT_INSTANCE_ID; const greeting = `${consumerProvidedGreeting} World from ${instanceId}`; res.send(greeting); });