How to use the firebase-admin/.apps function in firebase-admin

To help you get started, we’ve selected a few firebase-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github calluswhatyouwant / musicritic / server / firebase / admin.js View on Github external
import * as admin from 'firebase-admin/';

import config from '../config';

if (admin.apps.length === 0) {
    admin.initializeApp({
        credential: admin.credential.cert(config.firebase.serviceAccount),
        databaseURL: config.firebase.databaseUrl,
    });
}

export const db = admin.database();
export const ref = db.ref('/musicritic');
export const auth = admin.auth();