To start using Firebase in your project, make sure to include the JavaScript SDK provided by Firebase and configure your app.
<script src="https://www.gstatic.com/firebasejs/4.5.0/firebase.js"></script>
<script>
// Set up Firebase
// Remember to replace placeholders with your actual project information
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
firebase.initializeApp(config);
</script>
Once configured, you can read data from Firebase using the following code:
firebase.database().ref('/list').once('value').then(function(data) {
// ...
});
For a more comprehensive guide, refer to the documentation linked below:
Add Firebase to your JavaScript Project