firebase-admin-interop
firebase-admin-interop copied to clipboard
Update README with some basic run / deploy commands
As a nodejs newbie, I'm a little lost on the run / deployment model.
a) How do I run this with node? b) Does this work with the firestore emulator? Any tips?
Doing some experimenting, this is what worked for me:
To initialize the app, the following is sufficient:
final admin = FirebaseAdmin.instance;
final app = admin.initializeApp();
Note that it is not required to pass in the service account json, or the URL of the emulator, provided you do the following:
To run against the "real" firestore, set the following env var:
export GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service_account.json
# Run your compiled app
node build/node/my_admin_app.dart.js
To run against the emulator (assume it is running firebase emulators:start
), make sure the previous variable is unset, and intead set:
export FIRESTORE_EMULATOR_HOST=localhost:8080
node build/node/my_admin_app.dart.js