Vue PWA mylog Source Code

firebase.js

그랜파 개발자 2024. 11. 7. 05:11

firebase.js

// src/firebase.js
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
import { getFirestore, collection, addDoc, getDoc, 
         getDocs, setDoc, deleteDoc, query, where, 
         updateDoc, doc, orderBy, arrayUnion, 
         increment } from "firebase/firestore";
import { getMessaging, getToken } from "firebase/messaging";

const firebaseConfig = {
  apiKey: process.env.VUE_APP_FIREBASE_API_KEY,
  authDomain: process.env.VUE_APP_FIREBASE_AUTH_DOMAIN,
  projectId: process.env.VUE_APP_FIREBASE_PROJECT_ID,
  storageBucket: process.env.VUE_APP_FIREBASE_STORAGE_BUCKET,
  messagingSenderId: process.env.VUE_APP_FIREBASE_MESSAGING_SENDER_ID,
  appId: process.env.VUE_APP_FIREBASE_APP_ID,
};

// npm install dotenv - env가 정상 동작하지 않을 때 설치 필요함

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
// Initialize Firestore 
const db = getFirestore(app);

// Initialize Firebase Cloud Messaging (FCM)
const messaging = getMessaging(app);

export { auth, db, messaging, collection, addDoc, getDoc, 
         getDocs, setDoc, deleteDoc, query, where, updateDoc, 
         doc, arrayUnion, orderBy, increment };

'Vue PWA mylog Source Code' 카테고리의 다른 글

store/mylogs.js  (0) 2024.11.11
store/fcm.js  (0) 2024.11.09
store/auth.js  (0) 2024.11.09
store/index.js  (0) 2024.11.09
router  (0) 2024.11.08