웹프레임워크/vue.js

firestore 사용하기

quantumcode 2022. 1. 15. 02:15
728x90

/*import firebase from "firebase";*/
import firebase from "firebase/app";
import "firebase/firestore";

Vue.config.productionTip = false

// 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: "AIzaSyCH9RTm9xL-jvk1gHtz9J5zIKoMYRdfzhg",
  authDomain: "test-2577a.firebaseapp.com",
  projectId: "test-2577a",
  storageBucket: "test-2577a.appspot.com",
  messagingSenderId: "210830439691",
  appId: "1:210830439691:web:f006a2fadc2ae1fffa1e0e"
};

const firebaseApp = firebase.initializeApp(firebaseConfig);// 초기화

export const db = firebaseApp.firestore(); // 외부에서 사용할 수 있게 export

db.collection("user").get().then((querySnapshop) => {
  querySnapshop.forEach((doc) => {
    console.log(doc.id, " => ", doc.data());
  })
});

'웹프레임워크 > vue.js' 카테고리의 다른 글

mounted, created 차이점  (0) 2022.01.22
firebase 파일 분화하여 적용  (0) 2022.01.21
v-for 구문 v-bind:key  (0) 2022.01.21
vue.js 콤포넌트에서 data 선언  (0) 2022.01.15
vue js + webpack install( 설치 )  (0) 2022.01.14