Giter VIP home page Giter VIP logo

node-firebase-rest-client's Introduction

Firebase REST Client for Node

Lightweight Node REST Client for Firebase

Requests are made using the HTTP Fetch API via node-fetch, so expect to receive a compatible Promise for any request

Note you can bring your own Promise library by calling FirebaseClient.setPromise(Promise);

Usage

Instantiate a Client

var client =
  new FirebaseClient('https://app.firebaseio.com', { auth: 'BLORGBLORGBLORG' });

Reading Data (GET)

// Read from Firebase
client.get('path/to/data').
  then(res => res.json()).
  then(json => console.log(json));

// Shorthand for the above
client.getJSON('path/to/data').
  then(json => console.log(json));

// Get unparsed text instead
client.getText('path/to/data').
  then(text => console.log(text));

// You can pass query parameters as the second argument too!
client.getJSON('path/to/data', { orderBy: '$value', limitToFirst: 2 }).
  then(json => console.log(json));

Writing Data (PUT)

client.post('path/to/data', { a: 1 }).then(/* ... */);

// You can use the `#set` alias instead for parity with the Firebase Node library.
client.set('path/to/data', { a: 1 }).then(/* ... */);

Deleting Data (DELETE)

client.delete('path/to/data').then(/* ... */);

// You can use the `#remove` alias instead for parity with the Firebase Node library.
client.remove('path/to/data').then(/* ... */);

Updating Data (PATCH)

client.patch('path/to/data', { a: 1 }).then(/* ... */);

// You can use the `#update` alias instead for parity with the Firebase Node library.
client.update('path/to/data', { a: 1 }).then(/* ... */);

Pushing Data (POST)

client.post('path/to/posts', 1).then(/* ... */);

// You can use the `#push` alias instead for parity with the Firebase Node library.
client.push('path/to/posts', 1).then(/* ... */);

More Documentation and Examples

See the source and the specs. There be hidden treasure.

Install

npm install node-fetch --save

node-firebase-rest-client's People

Contributors

fny avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.