You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After you clone this repo to you local machine, run these CLI commands: (no need to npm install first)
cd learning-firebase-local-emulator
npm i -g firebase-tools
firebase init
Very basic setup from scratch
curl -sL firebase.tools | bash
# firebase logout# firebase login
firebase init # I personally chose the firestore and emulators option, and opted out of using a default project# you might have to
firebase login --reauth
firebaseConfig={projectId: ...your-project-id-here...,};firebase.initializeApp(firebaseConfig);database=firebase.firestore();if(location.hostname==="localhost"){// to use the emulator instead of the real DB:database.useEmulator("localhost",8080);}
To backup and reuse local data of the running emulator:
firebase emulators:export seed
# (remember the export path)# (and then upon restarting the emulator:)
firebase emulators:start --import seed
You might also find interesting:
firebase emulators:start --import seed --export-on-exit=seed
# see it repopulated at https://localhost:4000/firestore