Express Firebase
A very good helper library for connecting react js applications to firebase. It is basically wrapper of all firebase functions
Installation
yarn add express-firebase
or
npm install --save express-firebase
Usage
import expressFirebase from 'express-firebase';
const firebaseConfig = {
apiKey: 'xxxxxxxxxxxxxxxxx',
authDomain: 'xxxxxxxxxxxxxxxxx',
databaseURL: 'xxxxxxxxxxxxxxxxx',
projectId: 'xxxxxxxxxxxxxxxxx',
storageBucket: 'xxxxxxxxxxxxxxxxx',
messagingSenderId: 'xxxxxxxxxxxxxxxxx',
appId: 'xxxxxxxxxxxxxxxxx',
};
expressFirebase.connect(firebaseConfig);
Add Data
await expressFirebase.post('/add',
{name:'I love express firebase',version:'1.0.0'});
Get Data
const response = await expressFirebase.get('/add');
Update
await expressFirebase.put('/add',
{name:'I Love Express Firebase Updated',version:'1.0.1'});
Delete
await expressFirebase.delete('/add','xxxxxxxxxxxxxxx');
Upload Image
const imageUrl = await expressFirebase.uploadFile('imageName','image data');
Login
const response = await expressFirebase.login('abc@gmail.com','password');
Signup
const signup = await expressFirebase.signup('abc@gmail.com','password');
Logout
const response = await expressFirebase.logout();
Get Current User
const response = await expressFirebase.getCurrentUser();
isLoggedIn
const response = await expressFirebase.isLoggedIn();
Email Verification
const response = await expressFirebase.sendEmailVerification();
OAuth - Google
const response = await expressFirebase.loginWithGoogle();
OAuth - Github
const response = await expressFirebase.loginWithGithub();