Node.js-like firebase module for cloud sex code

I am trying to integrate Firebase with Parse to add real-time capabilities to my application. However, some API functions (for example, the ability to limit Firebase requests using limit () or startAt () / endAt ()) are not available in the firebase REST API.

They are available with the Node.js module, but even though Parse Cloud supports modules like CommonJS, I’m not sure that you can integrate the Firebase node module without any big configuration.

Any idea how I could access these features other than starting my own Node.js server with the Firebase plugin and using it to redirect my calls to firebase?

+4
source share
2 answers

It seems like it's possible. What you need to do is create a β€œcloud code module” and wrap the necessary Firebase tools. There is a tutorial here

These are pretty standard node.js. structures You put all of your Firebase methods into exports , you added the initialize method (are you probably doing something like auth here?), And you leave.

Firebase binding is not complicated or lengthy. Here's the gist that, for example, wraps Firebase in a promise structure . You could mainly use the methods from this principle as a scheme for transferring them to Parse.

+1
source

It seems to me that this is not easy, firebase depends on faye-websocket and, in turn, requires other libs. We can make it work using the "Cloud Code Module", but I don't like to add libraries this way.

This is a request for Parse to support node modules, unfortunately the answer is flat NO of them at the moment https://parse.com/questions/using-npm-modules-in-cloud-code .

Would thank for this update. Thanks!

+1
source

Source: https://habr.com/ru/post/1493623/


All Articles