-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase_training.html
40 lines (37 loc) · 1.24 KB
/
firebase_training.html
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
<!DOCTYPE html>
<html>
<head>
<script>
//firebaseの初期化
const firebaseConfig = {
apiKey: "AIzaSyB3VsN2RAvd8tE21y49nvpSulcnK0Mmphw",
authDomain: "creativemonozukuri.firebaseapp.com",
projectId: "creativemonozukuri",
storageBucket: "creativemonozukuri.appspot.com",
messagingSenderId: "290080836882",
databaseURL: "https://creativemonozukuri-default-rtdb.asia-southeast1.firebasedatabase.app/",
appId: "1:290080836882:web:6728d403300e3e22d837cb"
};
firebase.initializeApp(firebaseConfig);
//データベースへの参照の取得
database = firebase.database();
//データを追加する
dbDataRef = database.ref("test");
// dbDataRef.set({
// name: "Yoshida",
// city: "Tokyo"
// })
</script>
</head>
<body>
<div id="content">
</div>
<script
dbTopicsRef = database.ref("topics");
dbTopicsRef.on("value", (snapshot) =>{
data = snapshot.val();
console.log(data);
}
</script>
</body>
</html>