问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/37393524/how-to-set-geofire-in-node-js