Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cloud Functions para Firebase

Cloud Functions para Firebase

Talk apresentada no Google I/O Extended (Relâmpago) - GDG Campinas.

#firebase #functions

Felipe Arimateia

June 21, 2017
Tweet

More Decks by Felipe Arimateia

Other Decks in Technology

Transcript

  1. “ O Cloud Functions para Firebase permite que você execute

    tarefas no backend em resposta a eventos do Firebase e requisições HTTP.
  2. Firebase Authetication exports.newUser = functions.auth.user().onCreate(event => { const user =

    event.data; const email = user.email; const displayName = user.displayName; const uid = user.uid; const photoURL = user.photoURL; return admin.database().ref("/users").child(uid).update({"uid":uid, "email":email, "displayName":displayName, "photoURL":photoURL}) })
  3. Firebase Cloud Storage exports.createMessagePhoto = functions.storage.object().onChange(event => { const object

    = event.data; const file = gcs.bucket(object.bucket).file(object.name); const metadata = object.metadata // Exit if this is a move or deletion event. if (object.resourceState === 'not_exists') { return console.log('This is a deletion event.'); } //... })