exports.makeUppercase = functions.database.ref('/messages/{pushId}/original').onCreate(event => { const original = event.data.val() console.log('Uppercasing', event.params.pushId, original) const uppercase = original.toUpperCase() return event.data.ref.parent.child('uppercase').set(uppercase) })
$ cd your_project_dir $ firebase experimental:functions:shell
i functions: Preparing to emulate functions. ✔ functions: makeUppercase firebase>
makeUppercase('foo')
info: User function triggered, starting execution info: Uppercasing pushId1 foo info: Execution took 892 ms, user function completed successfully
makeUppercase('foo', {params: {pushId: 'custom_push_id'}})
$ firebase experimental:functions:shell < tests.js