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 };