{"id":18605309,"url":"https://github.com/fny/node-firebase-rest","last_synced_at":"2025-04-10T20:30:58.034Z","repository":{"id":57236643,"uuid":"59438317","full_name":"fny/node-firebase-rest","owner":"fny","description":"Firebase REST Client for Node.js","archived":false,"fork":false,"pushed_at":"2016-06-02T16:22:14.000Z","size":36,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T03:51:14.264Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-22T23:00:51.000Z","updated_at":"2020-02-24T03:08:31.000Z","dependencies_parsed_at":"2022-08-23T16:20:17.378Z","dependency_job_id":null,"html_url":"https://github.com/fny/node-firebase-rest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fny%2Fnode-firebase-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fny%2Fnode-firebase-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fny%2Fnode-firebase-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fny%2Fnode-firebase-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fny","download_url":"https://codeload.github.com/fny/node-firebase-rest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248290019,"owners_count":21078923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T02:20:49.485Z","updated_at":"2025-04-10T20:30:57.646Z","avatar_url":"https://github.com/fny.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Firebase REST Client for Node :fire:\n\n[![Build Status](https://travis-ci.org/fny/node-firebase-rest.svg?branch=master)](https://travis-ci.org/fny/node-firebase-rest) [![npm version](https://badge.fury.io/js/firebase-rest.svg)](http://badge.fury.io/js/firebase-rest) [![Dependencies](https://david-dm.org/fny/node-firebase-rest.svg)](https://david-dm.org/fny/node-firebase-rest)\n\n - Query support with proper JSON encoding.\n - Requests with the [WHATWG Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) via [node-fetch](https://www.npmjs.com/package/node-fetch).\n - You can bring your own Promise library with `FirebaseREST.setPromise(Promise)`.\n - Typescript (if you're into that.)\n\n## Installation\n\n```\nnpm install firebase-rest --save\n```\n\n## Usage\n\n```javascript\n// Don't forget `.default` at the end! (We use ES6 modules from the future.)\nconst FirebaseREST = require('firebase-rest').default;\n```\n\nInstantiate either the `FirebaseREST.JSONClient` or the `FirebaseREST.Client`, and start making calls. What's the difference?\n\n - `JSONClient` promises a Fetch-like response where the `#body` is parsed JSON\n - `Client` promises a standards compliant Fetch response\n\nConfused yet? This `#get` example should make the difference clear:\n\n```javascript\n// First instantiate a client with any default query parameters such as auth\nvar standardClient =\n  new FirebaseREST.Client('https://app.firebaseio.com', { auth: 'SECRET' });\n\nvar jsonClient =\n  new FirebaseREST.JSONClient('https://app.firebaseio.com', { auth: 'SECRET' });\n\n// Then start making requests\nstandardClient.get('/')\n  .then(res =\u003e res.json())\n  .then(json =\u003e /* do something with the json */);\n\njsonClient.get('/')\n  .then(res =\u003e /* do something with the res.body */);\n```\n\nIf you're still confused, see \"`Client` vs `JSONClient`\" below for a deep dive.\n\nYou can make the following requests with either client:\n\n```javascript\n// Reading data (GET)\nclient.get('/path');\nclient.get('/path', additionalQueryParams);\n\n// Writing data (PUT)\nclient.put('/path', payload);\nclient.put('/path', payload, additionalQueryParams);\n\n// Updating data (PATCH)\nclient.patch('/path', payload);\nclient.patch('/path', payload, additionalQueryParams);\n\n// Pushing data (POST)\nclient.post('/path', payload);\nclient.post('/path', payload, additionalQueryParams);\n\n// Removing data (DELETE)\nclient.delete('/path');\nclient.delete('/path', additionalQueryParams);\n```\n\n - `additionalQueryParams`: Additional URL params to merge with the default params provided (e.g. `{ orderBy: '$value', limitToFirst: 2 }`, `{ shallow: true }`.)\n - `'/path'`: Path to a part your DB, no `/` required.\n - `payload`: Object to write to Firebase\n\n`FirebaseREST` also provides aliases to match the semantics of the official Firebase JavaScript library:\n\n```javascript\nclient.set === client.put;       // =\u003e  true\nclient.update === client.patch;  // =\u003e  true\nclient.push === client.post;     // =\u003e  true\nclient.remove === client.delete; // =\u003e  true\n```\n\n## `Client` vs `JSONClient`\n\nYou can see the differences when comparing two GET requests. TLDR, you probably want to use `JSONClient`: it's supremely convenient.\n\n```javascript\n//\n// Standard Client\n//\n\nconst responsePromise = client.get('/').then(res).then(console.log);\n// =\u003e Body {\n//   url: 'https://app.firebaseio.com/.json?auth=SECRET',\n//   status: 200,\n//   statusText: 'OK',\n//   headers: Headers { ... },\n//   ok: true,\n//   body: PassThrough { ... },\n//   ... }\nresponsePromise.then(res =\u003e res.json()).then(console.log);\n// =\u003e { db: 'contents' }\n\n//\n// JSON Client\n//\n\njsonClient.get('/').then(console.log);\n// =\u003e JSONResponse {\n//   url: 'https://app.firebaseio.com/.json?auth=SECRET',\n//   status: 200,\n//   statusText: 'OK',\n//   headers: Headers { ... },\n//   ok: true\n//   body:\n//    { db: 'contents' }\n```\n\n## More Documentation and Examples\n\nSee the source and the specs. There be hidden treasure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffny%2Fnode-firebase-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffny%2Fnode-firebase-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffny%2Fnode-firebase-rest/lists"}