3

I'm a newbie in NodeJS as well in Geofire. So, I want to know wheter is possible to set Geofire in NodeJS or not. I've tried to do the following: ...

var geofire = require('geofire')
var firebase = require('firebase');
var db = new firebase.database();
var ref = db.ref('path/to/repo');
geofire = new Geofire(ref) ; // THIS DOESN'T WORK.

I couldn't set geofire object properly. How could I do it in the right way?

blackjack
  • 1,081
  • 2
  • 13
  • 30

1 Answers1

5

I think you need to respect the case in your first line :

var GeoFire = require('geofire');

then

var firebaseRef = firebase.database().ref();
// Create a GeoFire index
var ref = new GeoFire(firebaseRef);

Let me know if this works.

Simon Bengtsson
  • 7,573
  • 3
  • 58
  • 87
Guitz
  • 1,385
  • 1
  • 9
  • 6
  • Thanks a lot for your contribution. For some reason I didn't notice the case. I was tired I guess. However, firebase ref is set in the way you do. That made it work as expected.Thanks. – blackjack May 26 '16 at 21:23