1.firebase 의 firestore 세팅

2.파이어베이스에 데이터 저장

1.firebase의 firestore 세팅

  1. 프로젝트 생성

  1. Authentication에 들어가 원하는 인증 방식 연결

  1. 패키지를 다운 받는다
$ npm init
$ npm install --save firebase
  1. firebase를 연동할 페이지에 아래 와 같은 코드를 삽입 하면 firebase의 연동은 끝!!
import firebase from 'firebase';
const firebaseConfig = {
    apiKey:                                       , //key는 git에 올리지 말것
    authDomain: "nextsns-e75b1.firebaseapp.com",
    projectId: "nextsns-e75b1",
    storageBucket: "nextsns-e75b1.appspot.com",
    messagingSenderId: "181774016164",
    appId: "1:181774016164:web:330a272847c4dcc85b5031",
    measurementId: "G-4W87LLZGK4"
  };
  firebase.initializeApp(firebaseConfig);

<aside> 💡 여기서 주의 할점!!! : firebase.initializeApp(firebaseConfig); 가 두번 호출 될 경우에는'Firestore has already been started and its settings can no longer be changed' 메세지가 뜨게 되니깐 주의 !! '

</aside>

추가 적으로 파이어베이스 세팅 코드는 아래 문서 참조!!

Learn more about Web and Firebase

👉페이지 별로 초기화를 하기 때문에 다른페이지에서는 초기화가 안될 수도 있고

또한 새로고침 하여 다시 들어 올경우 다시 초기화 될 수있는 위험이 있기 때문에 파일로 만들어서 관리하는 것이 효율 적🔨