I am trying to connect to Firebase Realtime Database, but I cannot.
import { initializeApp } from "firebase/app";
// Import the functions you need from the SDKs you need
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyDDQLlluO4FusOQ8ucJvD_svdMJE5dkOlw",
authDomain: "portfolio-4dd8c.firebaseapp.com",
databaseURL: "https://portfolio-4dd8c-default-rtdb.europe-west1.firebasedatabase.app",
projectId: "portfolio-4dd8c",
storageBucket: "portfolio-4dd8c.appspot.com",
messagingSenderId: "237808071168",
appId: "1:237808071168:web:006dc98a6c3272fbd39ee5"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
I import firebase from 'firebase' and app.database(), but it give me an error (app.database() is not a function). I also tried import firebase from 'firebase/app'
when I write this import firebase from 'firebase', terminal gives me error below:
This dependency was not found:
- firebase in ./src/main.js
To install it, you can run: npm install --save firebase Error from chokidar (C:): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
You need to import getDatabase to get a Database instance using Modular SDK:
import { initializeApp } from "firebase/app"
import { getDatabase } from "firebase/database"
const app = initializeApp({...config})
const db = getDatabase(app)
export { db }