Login at https://firebase.com using Google Sign-In
</>
to create a new app.In your web application make the following modifications.
HTML
Add the following code just before <script src="script.js"></script>
in your HTML file.
<script src="https://www.gstatic.com/firebasejs/7.2.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.2.0/firebase-firestore.js"></script>
JavaScript
Add the following at the very top of your Javascript file. The global db
variable will contain your Firestore database reference.
var db;
Copy the portion of code provided for you on the Firebase site that looks like the following. IMPORTANT: You are not copying all of the code they provide you. Look carefully at the example below Paste the code inside your setup()
function at the top.
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "***",
authDomain: "***",
databaseURL: "***",
projectId: "***",
storageBucket: "***",
messagingSenderId: "***",
appId: "***"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
Then add the following just below what you pasted.
db = firebase.firestore();
Lastly, on the Firebase web site, click the button to go to the console to continue.
create database
It will take a few moments to build. You are now ready to use Firestore in your web app.
Firebase Docs on Authentication
Firebase Docs on Adding Data to Firestore
Firebase Docs on Deleting Data from Firestore