-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitialize.js
76 lines (55 loc) · 1.73 KB
/
initialize.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var firebase = require('firebase');
var serviceAccount = require("./clubselector-2394a-firebase-adminsdk-oc2gl-1792a43ff3.json");
firebase.initializeApp(
{
apiKey: "AIzaSyDrtl3qnLx_ZfdgxpUVy5XFvkXR4_f6_VU", // Auth / General Use
authDomain: "Clubselector.firebaseapp.com", // Auth with popup/redirect
databaseURL: "https://clubselector-2394a.firebaseio.com/", // Realtime Database
storageBucket: "Clubselector.appspot.com", // Storage
messagingSenderId: "1039301954159"
}
);
var db = firebase.app().database();
if (firebase.apps.length === 0) {
var msg = 'didnt connect';
console.log(msg);
}
var ref = db.ref('clubselector-2394a');
var refTest = firebase.app().database().ref().child('rootNode');
refTest.set({
Node1: 'Orange'
})
/*function writeNewUser(userId, name) {
firebase.database().ref('users' + userId).set({
username: name
});
}*/
/*ref.once(‘value’).then(
function (snap)
{
console.log(‘snap.val()’, snap.val());
}
);*/
var msg = 'connection was successful';
console.log(msg);
/* var usersRef = ref.child('Node1’);
// Create a new ref and log it’s push key
var userRef = usersRef.push();
console.log(‘user key’, userRef.key);
// Create a new ref and save data to it in one step
var userRef = usersRef.push({
name: ‘Christopher’,
description: ‘I eat too much ice cream’
});*/
//var usersRef = ref.child('Node1');
/*firebase.database().ref('users/'+ Node1).set(
{
Jake: {
Name: 'Orange'
}
}
);*/
//writeNewUser(Jake, 'orange');
var msg = 'change successful';
console.log(msg);
//firebase.database().goOffline()