Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 4.05 KB

README.md

File metadata and controls

78 lines (64 loc) · 4.05 KB

adonis-firebase

Firebase client and admin SDK wrapper for Adonis JS 4.0

Install

npm install adonis-firebase --save

Usage

Create a file in app/config/firebase.js and paste the code below by replacing it's values where necessary. Sample configuration can also be found in src/sample-config/firebase.js:

'use strict';

/*
 |--------------------------------------------------------------------------
 | Firebase
 |--------------------------------------------------------------------------
 |
 | Provide details of firebase project
 |
 */

module.exports = {

  /*
   |--------------------------------------------------------------------------
   | Firebase Admin credentials key file
   |--------------------------------------------------------------------------
   */
  credentials: "",
  /*
   |--------------------------------------------------------------------------
   | API key
   |--------------------------------------------------------------------------
   */
  apiKey: "",
  /*
   |--------------------------------------------------------------------------
   | Auth
   |--------------------------------------------------------------------------
   */
  authDomain: "",
  /*
   |--------------------------------------------------------------------------
   | Database
   |--------------------------------------------------------------------------
   */
  databaseURL: "",
  /*
   |--------------------------------------------------------------------------
   | Hosting
   |--------------------------------------------------------------------------
   */
  storageBucket: ""

};

Also you need to add the provider to AdonisJS at app/bootstrap/app.js:

const providers = [
   ...
   'adonis-firebase/providers/Firebase',
   'adonis-firebase/providers/FirebaseAdmin'
];

then you can simply call it from within controllers etc:

const Firebase = use('Firebase');
const FirebaseAdmin = use('FirebaseAdmin');