Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FeathersJS with Firebase architecture

I have an existing Firebase application (Which was built for quick prototyping and which is now grown big, I don't intend to move because existing dependencies and also because ease of use and authentication tied up) and I am trying to build a Rest API using FeatherJS.

It seems it is really easy to work with FeathersJS if you are using a standard database (MongoDB, etc). How can I integrate Firebase with Feathers keeping the best practices in place (Service Architecture, AOP)? Can I override service in Feathers and map it to my Firebase Rest endpoint?

I created a custom service in Feathers and tried doing this :

  get(id, params) {
    return Promise.resolve(FirebaseRef.child(id).once('value'));
  }

I get the:

Converting circular structure to JSON error

Is what I am doing correct?

like image 340
TJ_ Avatar asked Sep 06 '16 00:09

TJ_


1 Answers

This worked :

return Promise.resolve(FirebaseRef.child('userId1').once('value').then(function (snap) {
          return snap.val();
        }));

I am still unsure if this is how I would best integrate Firebase with FeathersJs

like image 89
TJ_ Avatar answered Oct 30 '22 23:10

TJ_