laforja/JS/gestiondb.mjs

22 lines
848 B
JavaScript
Raw Normal View History

2023-12-11 11:33:03 +01:00
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
import { getFirestore, getDocs, collection, addDoc, setDoc, deleteDoc, doc, query, where } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js"
const firebaseConfig = {
apiKey: "AIzaSyCj4QvZVKS8hH-QfIH_DsAM0MRvamd7LbA",
authDomain: "webforja-31b8b.firebaseapp.com",
projectId: "webforja-31b8b",
storageBucket: "webforja-31b8b.appspot.com",
messagingSenderId: "294376462200",
appId: "1:294376462200:web:98d4daceb731ab1b57da8d",
measurementId: "G-MCR5EEE6GK"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
const prueba = collection(db, "productos");
const snapshotProductos = await getDocs(prueba);
const productos = snapshotProductos.docs
console.log(snapshotProductos)