rf

rest-firebase

REST client for Firebase

Showing:

Popularity

Downloads/wk

7

GitHub Stars

1

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

190.9KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

REST Firebase

Build Status

REST client for Firebase. Mainly use for e2e tests when you might need to send concurrent requests from different users.

Note that if the oauth token enable debugging, the firebase rules debug message will be logged.

Install

npm install rest-firebase

Usage

const restFirebase = require('rest-firebase');
const firebase = restFirebase.factory('some-id');
const ref = firebase({paths: 'some/path', auth: 'some-oauth-token'});

// ref.toString() === 'https://some-id.firebaseio.com/some/path.json'

// you can pass parameters
// (see https://www.firebase.com/docs/rest/api/#section-query-parameters)
ref.get({shallow: true}).then(value => {
  // do something with value
}).then(
  // Set value of the branch
  () => ref.set({foo: 1})
).then(
  // patch some children of the branch
  () => ref.update({bar: 2})
).then(
  // push new child
  ()=> ref.push(3)
).then(
  // delete branch
  () => ref.remove()
);

It can also be used to retrieve or set the DB security rules:

const restFirebase = require('rest-firebase');
const firebase = restFirebase.factory('some-id');
const ref = firebase({paths: 'some/path', auth: 'firebase-secret...'});
const newRules = '{"rules": {}}';


ref.rules().then(
  rules => console.log('old rules: %s', rules)
).then(
  () => ref.rules(newRules)
)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100