简体   繁体   English

相当于在Javascript中使用python-firebase的“ .get”语句?

[英]What is the equivalent of using python-firebase's “.get” statement in Javascript?

I wrote python code that looks like this and returns the enire JSON database. 我编写了如下所示的python代码,并返回了整个JSON数据库。

from firebase import firebase
firebase = firebase.FirebaseApplication('https://name_name_name.firebaseio.com/')
result = firebase.get('/results', None)

I have tried to do the same thing in javascript with no success. 我试图用javascript做同样的事情,但没有成功。 This should be straight forward but I haven't seen any solutions. 这应该很简单,但是我还没有任何解决方案。 The idea is to host this on the server. 想法是将其托管在服务器上。 It will pass the result variable to an XML converter. 它将结果变量传递给XML转换器。 The XML will print to either that same document or another document in the directory. XML将打印到同一文档或目录中的另一文档。

What is the JavaScript equivalent of my Python code? JavaScript与我的Python代码等效吗?

Without any real information on where your code runs, you probably want https://www.npmjs.com/package/firebase , which can be used both in the client (eg browsers) as well as in standard OS context (offline/server/general scripting language). 在没有代码运行位置的任何真实信息的情况下,您可能需要https://www.npmjs.com/package/firebase ,它可以在客户端(例如浏览器)以及标准操作系统环境(脱机/服务器)中使用/通用脚本语言)。

for anything JavaScript, http://npmjs.com is your one stop "is there something to do X" open source shop. 对于任何JavaScript, http://npmjs.com都是您的一站式“有事做X”开源商店。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM