Santosh Nepal
Santosh Nepal

Reputation: 1

how to initialize multiple app in firebase admin

I am new to firebase cloud messaging and i am practicing it on node js and i found that we can initialize more than one app on same project . I want to know up to how many app can we initialize in one project

Upvotes: -1

Views: 996

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83058

How to initialise multiple apps in Firebase Admin SDK

There is a specific section in the doc for this case. It shows the following code:

// Initialize the default app
initializeApp(defaultAppConfig);

// Initialize another app with a different config
var otherApp = initializeApp(otherAppConfig, 'other');

console.log(getApp().name);  // '[DEFAULT]'
console.log(otherApp.name);     // 'other'

// Use the shorthand notation to retrieve the default app's services
const defaultAuth = getAuth();
const defaultDatabase = getDatabase();

// Use the otherApp variable to retrieve the other app's services
const otherAuth = getAuth(otherApp);
const otherDatabase = getDatabase(otherApp);

I want to know up to how many app can we initialize in one project

I don’t have the answer to this question (i.e. I don’t know about any such limit) but you can initialise more than two apps.

Upvotes: 2

Related Questions