0
votes

Currently I'm building a nodejs express REST api using the below to access Firestore from my Google Cloud Platform:

const Firestore = require("@google-cloud/firestore");

const db = new Firestore();
const docRef = db.collection('users').doc('alovelace');

const ada = await docRef.set({
  first: 'Ada1',
  last: 'Lovelace',
  born: 1815
});

It picks up the keys from GOOGLE_APPLICATION_CREDENTIALS in a .env file.

Of course I want to develop locally rather than remotely constantly and I've come across the Firebase Firestore Emulator.

I've attempted to use db.useEmulator() but that isn't part of google cloud/firestore but is part of firebase-admin.

Is there any way of using the firestore emulator without going down the firebase-admin route?

1

1 Answers

1
votes

The Node.js SDK for client-side development also has a useEmulator call, so you should be able to connect it to the Firestore emulator in the same way.