Skip to content

Commit

Permalink
create firebase setup
Browse files Browse the repository at this point in the history
relates #66
  • Loading branch information
sophielevens committed Mar 27, 2018
1 parent 726127f commit 9cdf4c7
Show file tree
Hide file tree
Showing 13 changed files with 1,235 additions and 166 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "stimmy-things-infact"
}
}
6 changes: 6 additions & 0 deletions database.rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
10 changes: 10 additions & 0 deletions firebase-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function config() {
return {
apiKey: 'AIzaSyB_MH_CW9Y_79KlOAj476V59sTOisvjRk4',
authDomain: 'stimmy-things-infact.firebaseapp.com',
databaseURL: 'https://stimmy-things-infact.firebaseio.com',
projectId: 'stimmy-things-infact',
storageBucket: 'stimmy-things-infact.appspot.com',
messagingSenderId: '45676217448'
};
}
14 changes: 14 additions & 0 deletions firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import firebase from 'firebase/app';
import 'firebase/database';
import { config } from './firebase-config.js';

export function initFirebaseDB() {
firebase.initializeApp(config());
return firebase.database();
}

export const firebaseDB = initFirebaseDB();

export function addNewStim(db, stim) {
return db.stims.push(stim);
}
5 changes: 5 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"database": {
"rules": "database.rules.json"
}
}
Loading

0 comments on commit 9cdf4c7

Please sign in to comment.