Answers for "firebase add functions"

12

firebase deploy only function

firebase deploy --only functions:functionNameHere
Posted by: Guest on August-21-2020
0

firebase functions add to database

import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp(functions.config().firebase);

exports.onMsgAdded = functions.database.ref('/users/{uid}/messages/{to_uid}/{msg}').onCreate((snap, context) =>{
    const data = snap.val();
    const msgRoot = admin.database().ref('/users/' + context.params.to_uid + '/messages/' + context.params.uid);
    return msgRoot.set(data);
});
Posted by: Guest on July-03-2020

Browse Popular Code Answers by Language