ES 2017 transpilation
See file functions/index.es7 for the code.
The function is a simple hello world sample that will write "Hello " as the value of any node created as
/hello/<name> in the Firebase Realtime Database.
We're using some ES2017 syntax that is not supported natively by Cloud Functions such as async/await. The code will be transpiled to ES5 using the BabelJS CLI.
See the functions/package.json file for the
prepare script which runs the transpilation step.
Deploy and test
This sample comes with a Function and web-based UI for testing the function. To configure it:
- Create a Firebase Project using the Firebase Console.
- Clone or download this repo and open the
- You must have the Firebase CLI installed. If you don't have it install it with
npm install -g firebase-toolsand then configure it with
- Configure the CLI locally by using
firebase use --addand select your project in the list.
- Install dependencies locally by running:
cd functions; npm install; cd -
- Transpile the code bu running:
cd functions; npm run prepare; cd -
- Deploy your project using
- Open the Firebase console for your project and using the Realtime Database tab, create a node
true. Soon after the node has been created the Function will change the value to