Created
May 24, 2020 19:39
-
-
Save masautt/87e3e91040f0c9ca62b6c04d993119b3 to your computer and use it in GitHub Desktop.
Stats For Life Firebase Admin Setup
This file contains hidden or 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
import * as admin from "firebase-admin"; | |
// service-account.json is in project directory, not src | |
const serviceAccount = require("../service-account.json"); | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: "https://stats-for-life.firebaseio.com" | |
}); | |
const db = admin.firestore(); | |
// Test method, this should return { "key" : "8675309"} | |
db.doc("app-secrets/testData").get().then(data => console.log(data.data())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment