Skip to content

Commit

Permalink
finished http cloud function
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Schwarzmüller committed Dec 14, 2017
1 parent 0f4164e commit 57ecbe5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ exports.uploadFile = functions.https.onRequest((req, res) => {
busboy.end(req.rawBody);
});
});

exports.onDataAdded = functions.database.ref('/message/{id}').onCreate(event => {
const data = event.data.val();
const newData = {
msg: event.params.id + '-' + data.msg.toUpperCase()
};
return event.data.ref.child('copiedData').set(newData);
});

0 comments on commit 57ecbe5

Please sign in to comment.