Skip to content

Instantly share code, notes, and snippets.

@markreale
Created May 28, 2019 11:46
Show Gist options
  • Save markreale/4c753e98c1d484fe2729b083c6c5ecb6 to your computer and use it in GitHub Desktop.
Save markreale/4c753e98c1d484fe2729b083c6c5ecb6 to your computer and use it in GitHub Desktop.
Creating a configuration for Firebase Firestore in an HTML file
<!--
Access the Firebase tools you need
We are using the CDN here
You can change the version number (6.0.4) to whatever the latest version of Firebase is
You can put this content in the <head> of your HTML file, or just before the closing </body> tag -
- there is arguments for both approaches
-->
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-firestore.js"></script>
<script>
// Initialize Cloud Firestore through Firebase
// Customize the parts in the square brackets [] for your specific project
firebase.initializeApp({
apiKey: '[YOUR_API_KEY]',
authDomain: '[YOUR_DOMAIN]',
projectId: '[YOUR_PROJECT_ID]'
});
// Access the Firestore database and set it to a variable
var db = firebase.firestore();
// Write your JavaScript program here or...
</script>
<!-- ... include a reference to your JavaScript program in an external file here -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment