I want to show 'blogs' from my database in my web page. I already include the packages firebase-app and firebase-database,
but still it does not recognize initializeApp.
It show:
Uncaught ReferenceError: initializeApp is not defined
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-database.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h2> hello world </h2>
<!-- the functions you need from the SDKs you need-->
<!-- Import the functions you need from the SsDKs you need-->
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-database.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyDwq-CA3Fm1oYj3jLnPeeczNb9xXrKYtbo",
authDomain: "firebasic-a87d7.firebaseapp.com",
databaseURL: "https://firebasic-a87d7-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "firebasic-a87d7",
storageBucket: "firebasic-a87d7.appspot.com",
messagingSenderId: "701224819501",
appId: "1:701224819501:web:69eedfd3468db6f3f511a4",
measurementId: "G-WVEYYLK2VJ"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = firebase.database();
const blogRef = db.ref(blogs).on('value',handleSuccess,handleError);
function handleSuccess(items){
console.log(items);
}
function handleError(error){
console.log(error);
}
</script>
</body>
</html>