curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
Firebase JS SDK v9 へのアップデート備忘録
https://coconala.com/blogs/1638666/135318?srsltid=AfmBOor4AMbFk56aEsdeZk1-dOF6WJJwQr43MQTLdPVpsIQjNK3EGTob ;; 上におなじ
<html><head>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/11.5.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/11.5.0/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
import { getDatabase,ref,onValue} from "https://www.gstatic.com/firebasejs/11.5.0/firebase-database.js";
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyCcIW92ehZDJSAAJylBZGeeviyYtCPqous",
authDomain: "my-nodejs-e9414.firebaseapp.com",
databaseURL: "https://my-nodejs-e9414-default-rtdb.firebaseio.com",
projectId: "my-nodejs-e9414",
storageBucket: "my-nodejs-e9414.firebasestorage.app",
messagingSenderId: "64417285110",
appId: "1:64417285110:web:41cac867f805aec2c07dd7",
measurementId: "G-K0E78VTKBB"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
var database = getDatabase(app);
var people = ref(database, 'people/');
onValue(people, (snapshot) => {
const data = snapshot.val();
console.log(data);
});
</script>
</head>
<body>
<h1>latest datas</h1>
<ol id="list">wait...</ol>
</body>
</html>
0 件のコメント:
コメントを投稿