šŸ”„FIREBASE RESUMIDOšŸ”„

Thadeu luz

https://thadeu.us

ObrigatĆ³rios

Importantes

Bons

ObrigatĆ³rios

AutenticaĆ§Ć£o

AutenticaĆ§Ć£o

const config = { /* ... */ };

// Inicializar
firebase.initializeApp(config);

firebase.auth().onAuthStateChanged(function(user) {
    if (user) {
        // UsuƔrio logado
        console.log(`UsuƔrio logado: ${user.email}`)
    } else {
        // UserĆ”rio nĆ£o logado
    }
});

firebase.auth().signInWithEmailAndPassword(email, password);

AutenticaĆ§Ć£o

Firebase-UI

// FirebaseUI config.
var uiConfig = {
  signInSuccessUrl: '<url-to-redirect-to-on-success>',
  signInOptions: [
    // Leave the lines as is for the providers you want 
    // to offer your users.
    firebase.auth.GoogleAuthProvider.PROVIDER_ID,
    firebase.auth.FacebookAuthProvider.PROVIDER_ID,
    firebase.auth.TwitterAuthProvider.PROVIDER_ID,
    firebase.auth.GithubAuthProvider.PROVIDER_ID,
    firebase.auth.EmailAuthProvider.PROVIDER_ID,
    firebase.auth.PhoneAuthProvider.PROVIDER_ID
  ]
};

// Initialize the FirebaseUI Widget using Firebase.
var ui = new firebaseui.auth.AuthUI(firebase.auth());
// The start method will wait until the DOM is loaded.
ui.start('#firebaseui-auth-container', uiConfig);

Banco real-time

Banco real-time

var database = firebase.database();

// Escrever, atualizar e remover
database.ref('users/' + userId).set(user);

database.ref('users/' + userId).update({ nome: 'Fulano' });

database.ref('users/' + userId).remove();


// Ler/Ouvir
database.child("users").on('value', function(snapshot) {
  const valor = snapshot.val()
  console.log(`Dados recebidos: ${valor}`)
});

database.child("users").once('value', function(snapshot) {
  const valor = snapshot.val()
  console.log(`Os dados mudaram: ${valor}`)
});

importantes

Hospedagem

https://surge.sh

Alternativas

Hospedagem

Hospedagem

$ firebase deploy

Deploy

Storage

Storage

var storageRef = firebase.storage().ref();

storageRef.child("images/rivers.jpg").put(data)
  .then(function(snapshot) {
    console.log(`Imagem salva: ${snapshot.downloadURL}`);
  });

FUNCTIOns

+

=

+

=

=

+

bons

Analytics

Messaging

Test lab

Firestore

Obrigado!

Firebase Resumido

By Thadeu Luz

Firebase Resumido

  • 477