Firebase Emulator Part 1
Esteban Campos / September 15, 2020
1 min read • ––– views
Luckily, in my work from time to time, we try new things.
To use firebase emulator. Basically, you need to run it in a different session and it communicates with your app through web requests. So, for your project there is not difference between firebase running production and the emulation.
Import/Export Feature#
The firestore emulator per default doesn't persist the database. So, it's important to export manually when the session is going to end. It's kinda funky but it requires two sessions, one consuming the API against the other.
firebase emulators:start
firebase emulators:export --force ./saved-data
In later ocassions, we are going to have a stored database, so we need to tell firebase to start over that folder (e.g.: saved-data
).
firebase emulators:start --import=./saved-data
Firebase PATH#
To run firebase locally you can run:
node_modules/.bin/firebase --version
or, you can include node_modules/.bin
in your PATH:
export PATH="$PATH:./node_modules/.bin"
firebase --version