Is there a way to call a Firebase server "function" from within a client app, say with Angular 2? -


so firebase offers called "functions", nodejs server has of firebase stuff preconfigured , has scaling automatically handled. i'm wondering, there way call function inside of "functions" index.js file angular 2 app?

i need utilize firebase-admin npm module check if user's email exists , grab uid user, if does.

according link, can setup index.js file such as:

const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeapp(functions.config().firebase);  // i'm not sure if how part: exports.getuserbyemail = (email) => {   return admin.auth().getuserbyemail(email); } 

is there way can call getuserbyemail() inside of component in angular 2 app?

thanks in advance!

there 2 primary ways of invoking cloud function directly client code.

you can use database trigger responds when location in firebase project's realtime database changes.

you can use http trigger response when access http endpoint. web app, use whatever method want invoke xhr transaction.

whichever 1 use architecture of app, , degree preference. there plenty of samples of both, , more, in provided sample code.

you can use firebase admin sdk access project within function code. many of samples that.


Comments