DEV Community

TK
TK

Posted on • Updated on

Firebase: How to use emulator with express.js

If you use @google-cloud/firestore as firestore client and you want to use emulator, you can connect by below code

// In console

npx firebase emulators:start --project local-project-id

Enter fullscreen mode Exit fullscreen mode

And

// In app.ts
import {Firestore} from '@google-cloud/firestore'

const firestore = new Firestore({
  // Firestore emulator host
  host: 'localhost:4100',
  projectId: 'local-project-id',
  ssl: false,
  eexperimentalForceLongPolling: true
})

Enter fullscreen mode Exit fullscreen mode

Have a good day!!

Top comments (0)