Estoy intentando crear una herramienta web de notificaciones automáticas para mi aplicación de iOS. Por ahora, todo lo que estoy tratando de hacer es consultar mi base de datos Firebase Realtime y console.log los valores.
Mi esperanza era poder crear un documento HTML e integrar firebase usando CDN y albergar todo eso, junto con mi consulta en etiquetas.
Cuando hago esto, aparece un error en la consola que dice "Error de referencia no detectado: base de fuego no está definida"
¿Alguna idea de lo que me estoy perdiendo o por qué recibo este error?
Esto es lo que tengo en mis etiquetas de script:
<!DOCTYPE html><html lang="en"> <head></head> <body> <script type="module"> // Import the functions you need from the SDKs you need import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-app.js"; import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-analytics.js"; // TODO: Add SDKs for Firebase products that you want to use // https://firebase.google.com/docs/web/setup#available-libraries // Your web app's Firebase configuration // For Firebase JS SDK v7.20.0 and later, measurementId is optional const firebaseConfig = { apiKey: "xxxx", authDomain: "xxx", databaseURL: "xxx", projectId: "xxx", storageBucket: "xxx", messagingSenderId: "xxx", appId: "xxx", measurementId: "G-xxx" }; // Initialize Firebase const app = initializeApp(firebaseConfig); const analytics = getAnalytics(app); import { getDatabase } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-database.js"; const database = getDatabase(); </script> <script> //query database for ExpononentPushToken Values// const dbRef = firebase.database().ref(); dbRef.child("push_token").child(userId).get().then((snapshot) => { if (snapshot.exists()) { console.log(snapshot.val()); } else { console.log("No data available"); } }).catch((error) => { console.error(error); }); </script> </body> </html>