You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

easy-firebase-db

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-firebase-db

Firebase Database Api and CLI

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

db-api

A thin wrapper around the firebase npm module. Provides easy firebase authentication via environment variables, and exports basic database operations like GET, PUT, DEL. These are not firebase-specific, enabling applications that use db-api to easily switch databases. Also includes an interactive cli that provides a BASH-like interface for directly calling database operations.

Setup

npm install --production

Documentation

See the API

Using mocked firebase server

If you wish to develop with a slow or absent Internet connection, you can use firebase-server, a mocked Firebase server that is run on your computer.

Simply do the following:

  • Add a line containing 127.0.0.1 localhost.firebaseio.test to your hosts file.

On OS X and Linux, the hosts file is located at /etc/hosts. On Windows, it is located at %SystemRoot%\System32\drivers\etc\hosts.

  • Set the mockFirebase environment variable to true.

You can do this by adding mockFirebase=true to your leanonme-engine .env file or by running the command export mockFirebase=true.

Interactive CLI

Start the REPL with:

node repl.js <REL_PATH_TO_DOT_ENV_FILE>

Examples REPL Commands

Basic database operations:

DB> PUT meaning/of/life 42 
DB> GET meaning/of/life
DB> PUSH list/of/numbers 42
DB> MOVE meaning/of/life monty/python
DB> DEL monty/python

Note that no spaces are allowed in the path or the data.
BAD:
DB> PUT knights/who {say: "ni"}

Piping

Copy data

DB> GET path/in/db | PUT new/path/in/db

Load object from the module.exports line of a js file, into the database.

DB> REQUIRE data.js | UPDATE path/in/db

Contributing to this API

Setup

npm install

Running tests

npm test

Writing tests

Look at existing tests, and check out MochaJS and ArgueJS

Generating API.md file from tests

node_modules/mocha/bin/mocha --reporter markdown > API.md

FAQs

Package last updated on 10 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts