How to set Geofire in node.js

自闭症网瘾萝莉.ら 提交于 2020-01-13 19:40:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!