shorten-firebase.realtime-database

    1.4.0 • Public • Published

    Install Firebase and Shorten Firebase

    $ npm install firebase@8.10.0 shorten-firebase.realtime-database
    

    Features

    • Simple & easy to use 🤘
    • Beginner friendly 😱
    • Lightweight 🛬

    Getting Started

    // Examples
    
    const Shorten = require('shorten-firebase.realtime-database');
    const firebase = require('firebase');
    
    var firebaseConfig = {
    	apiKey: "xxxxxxxxxxxxxxxxxx",
    	authDomain: "xxxxxxxxx.firebaseapp.com",
    	projectId: "xxxxxxxxxxxxxxx",
    	storageBucket: "xxxxxxxxx.appspot.com",
    	messagingSenderId: "xxxxxxxxx",
    	appId: "x:xxxxxxxxx:web:xxxxxxxxxxxxxxxxxx"
    };
    
    firebase.initializeApp(firebaseConfig);
    const database = new Shorten(firebase);

    New changes

    + method fetch
    + updated error messages
    

    Methods

    // set
    database.set('user', { username: 'Michael' }); // ref, data
    
    // add
    database.add('balance', 'money', 20); // ref, property, value (Number)
    
    // subtraction
    database.add('balance', 'money', -10); // ref, property, value (Negative)
    
    // remove
    database.remove('balance'); // ref
    
    // get
    let userInfos = await database.get('balance'); // { Object }
    userInfos?.money ?? 0; // Checking if this property exists in the Object, if not, its value is 0 (zero).
    
    // fetch
    await database.fetch('balance', 'money'); // ref, property
    
    // Ping
    await database.ping(); // { Promise }

    Install

    npm i shorten-firebase.realtime-database

    DownloadsWeekly Downloads

    2

    Version

    1.4.0

    License

    ISC

    Unpacked Size

    4.79 kB

    Total Files

    3

    Last publish

    Collaborators

    • tales-sa-ako