Firebase
Making App
Go to firebase console and copy pasta the code they give you to setup connection.
Using Database/Firestore
Firestore allows you to live update data on as many devices as you want on the frontend. Add listeners to data.
For testing go to db setting, rules, and set read and write to true(allowing all users to read and write no auth)
Then you can add data
the DbRef gets the key value pair from text and on change changes the val of snap
Firebase Authenication
Allows ease console setup of Facebook auth, twitter, github, etc where all the user objects look the same
Using the promise
Signup event
Ref Objects
In the cloud, event.data.ref
.child('specificChild')
.set(value) //returns promise
Delta Snapshot
.ref //to get about ref
.changed() //boolean if changed
.val() //to get the actual value there
Getting val
Adding Backend APIS / Cloud Functions
Could do clientside, but like secrets on client?? and write for every platform?? Require the APIS apparently @google-cloud/speech can be require(nodejs right). Then you add listener to upload file and then use api then write to translationed file. So you handle the conversion clientside. Then deploy these
Setup
Need firebase CLI npm install -g firebase-tools
firebase login
Start Project firebase init functions
firebase deploy
Return the promise from the set method to allow it to wait or null/
Basic Usage
functions.database/firestore.ref('/somepath/1') Can do:
onWrite(), created, updated, or deleted
onCreate(), created
onUpdate(), updated
onDelete(), deleted
Return a null or a promise to be waited for b4 cleaning up
Get specific changes
Use .params.[key] to get the wildcard routes
Promises
Can use the promises as promises with then chains and all and such
Modularize Files
Nodejs style simply require i.e const location = require('./location.js');
Last updated