voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
61 lines (38 loc) • 1.82 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [/app](./app.md) > [initializeApp](./app.initializeapp.md)
## initializeApp() function
Creates and initializes a FirebaseApp instance.
See [Add Firebase to your app](https://firebase.google.com/docs/web/setup#add_firebase_to_your_app) and [Initialize multiple projects](https://firebase.google.com/docs/web/setup#multiple-projects) for detailed documentation.
<b>Signature:</b>
```typescript
export declare function initializeApp(options: FirebaseOptions, name?: string): FirebaseApp;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [FirebaseOptions](./app.firebaseoptions.md) | Options to configure the app's services. |
| name | string | Optional name of the app to initialize. If no name is provided, the default is <code>"[DEFAULT]"</code>. |
<b>Returns:</b>
[FirebaseApp](./app.firebaseapp.md)
The initialized app.
## Example 1
```javascript
// Initialize default app
// Retrieve your own options values by adding a web app on
// https://console.firebase.google.com
initializeApp({
apiKey: "AIza....", // Auth / General Use
authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect
databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database
storageBucket: "YOUR_APP.appspot.com", // Storage
messagingSenderId: "123456789" // Cloud Messaging
});
```
## Example 2
```javascript
// Initialize another app
const otherApp = initializeApp({
databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
storageBucket: "<OTHER_STORAGE_BUCKET>.appspot.com"
}, "otherApp");
```