DEV Community

sa3i0l
sa3i0l

Posted on

Firebase in vue

src/firebase/init.js

import { initializeApp } from 'firebase/app';
import { getFirestore, collection } from 'firebase/firestore'
import { getAuth } from 'firebase/auth'


// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey:
  authDomain: 
  databaseURL: 
  projectId:
  storageBucket: 
  messagingSenderId:
  appId: 
  measurementId: 
};



const firebase = initializeApp(firebaseConfig);


//const db = getFirestore()
//export default db
export const db = getFirestore()

// generate & export auth object
export const auth = getAuth()




Enter fullscreen mode Exit fullscreen mode

And now you can use it in components:

App.vue

    import { auth, db } from './firebase/init.js'



Enter fullscreen mode Exit fullscreen mode

Top comments (0)