Created
November 29, 2017 13:23
-
-
Save jthegedus/659afa14e70034b593feac80a50f320f to your computer and use it in GitHub Desktop.
ES6+ in Cloud Functions for Firebase - input for the last 3 examples
This file contains hidden or 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
// input - async/awaiy with CommonJS module syntax | |
const functions = require('firebase-functions'); | |
// returns a string after 5 seconds | |
const message = () => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(`from Babelified Cloud Functions!`) | |
}, 5000) | |
}) | |
} | |
module.exports.helloWorld = functions.https.onRequest(async (req, res) => { | |
let world = await message(); | |
res.status(200).send(`Hello ${world}`); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment