Last active
March 8, 2020 19:19
-
-
Save sambshapiro/849a331934e75f169fafb80cf1292078 to your computer and use it in GitHub Desktop.
Firebase Firestore & Cloud Functions Local Development with React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firebase = require('firebase/app'); | |
require('firebase/auth'); | |
require('firebase/functions'); | |
require('firebase/firestore'); | |
const firebaseConfig = { | |
apiKey: '', | |
authDomain: '', | |
databaseURL: '', | |
projectId: '', | |
storageBucket: '', | |
messagingSenderId: '', | |
appId: '', | |
measurementId: '', | |
}; | |
firebase.initializeApp(firebaseConfig); | |
if (window.location.hostname === 'localhost') { | |
console.log("testing locally -- hitting local functions and firestore emulators"); | |
firebase.functions().useFunctionsEmulator('http://localhost:5001'); | |
firebase.firestore().settings({ | |
host: 'localhost:8080', | |
ssl: false | |
}); | |
} | |
export const provider = new firebase.auth.GoogleAuthProvider(); | |
export const auth = firebase.auth(); | |
export const functions = firebase.functions(); | |
export const db = firebase.firestore(); | |
export const fieldval = firebase.firestore.FieldValue; | |
export default firebase; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment