firebase example
by Salmin Skenderovic
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://www.gstatic.com/firebasejs/3.6.2/firebase.js"></script>
<div class="panel panel-default">
<div class="panel-heading">Panel heading without title</div>
<div class="panel-body">
<pre id="pr"></pre>
</div>
</div>
JavaScript
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
apiKey: "AIzaSyBUBLp4BI4n8MCqZpqpjUQVO8LMztRq_TY",
authDomain: "proj2-aa6bd.firebaseapp.com",
databaseURL: "https://npf-caviar-89feb80.firebaseio.com",
storageBucket: "firebase-caviarsp.appspot.com",
messagingSenderId: "499654768239"
};
firebase.initializeApp(config);
var auth = firebase.auth();
var storageRef = firebase.storage().ref();
var db = firebase.database();
var rootRef = firebase.database().ref();
var urlRef = rootRef.child("pokemon");
urlRef.once("value", function(snapshot) {
snapshot.forEach(function(child) {
console.log(child.key+": "+child.val());
});
});