Giter Site home page Giter Site logo

firebase-admin-get-children-ids's Introduction

Firebase Admin Get Children IDs

Get children ids at a given path in your firebase realtime database.

const { getChildrenIDs } = require('firebase-admin-get-children-ids');
const firebase = require('firebase-admin');

const getUserIDs = async () => {
  const databaseURL = "<FIREBASE_DATABASE_URL>";
  const credential = require("./firebase-key.json");
  const userIDs = await getChildrenIDs('/users/', { firebase, credential, databaseURL });
  return userIDs;
}

This module is meant to run on node NOT on the browser or react-native.

Use this in your node server or on cli tools.

Installation

  yarn add firebase-admin-get-children-ids
  # If you don't already have firebase-admin as a dependency then add it too
  yarn add firebase-admin

Usage

  1. First you need a Private Key from firebase for privileged environments, find out how to get it here: https://firebase.google.com/docs/admin/setup (or replace YOUR_PROJECT_NAME_HERE with your project name here : https://console.firebase.google.com/project/YOUR_PROJECT_NAME_HERE/settings/serviceaccounts/adminsdk)

  2. Place that private key .json file somewhere in your project.

  3. Take note of your databaseURL

// Import it in your project

import { getChildrenIDs } from 'firebase-admin-get-children-ids'
// Or
const { getChildrenIDs } = require('firebase-admin-get-children-ids')

// Import firebase-admin
import firebase from 'firebase-admin'
// Or
const firebase = require('firebase-admin')


// Use it

const getUserIDs = async () => {
  const databaseURL = "<FIREBASE_DATABASE_URL>";
  const credential = require("./firebase-key.json");
  const userIDs = await getChildrenIDs('/users/', { firebase, credential, databaseURL });
  return userIDs;
}

firebase-admin-get-children-ids's People

Contributors

rakannimer avatar

Watchers

James Cloos avatar  avatar  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.