Up to now you've been seeing data from a local JSON file and that was great for testing purposes. Now, you need to get serious and connect a real database and you'll use Firebase for this purpose. In this video, learn how to set up your database with some rules to make it a bit more secure.
- [Instructor] Up to now we've been seeing data from a local JSON file, and that was great for testing purposes. Now we need to get serious and connect a real database and we'll use Firebase for this purpose. Let's get to it. So once you're logged into your account on Firebase and selected the right project for me it's crmLinkedIn2. So go into this section here and make sure you recognize the user that you created. If you want to test this you can do something like this, delete account like so.
Then go and refresh your application, your application should literally show you the log in again. Now switching for an account, no accounts are there, so let's create a new one. That's not my email for those that are paying attention. And then password and then login. And then it's going to create that user because its not created, if you log out of that application it would ask you to enter your credentials, and manny3@test so I'm in the right project, I just tested this, everything is working.
Now what we need to do is set up our database, so it's going to be very simple. You click on database. This is where you're going to see the users that are connected to your application, and the contacts that they have in their list. So let's go on rules, because you can't create a database unless you have rules and those rules are pretty loose. Not really strict in terms of what you can do. So let's just delete the whole thing, and then create new rules.
So, what I want to do is rules and create an object, and inside of that object you're going to have users make sure you put them as a string like so. And then we'll set the rules. So in order to be able to add data into the database you need to be logged in as a user, so this is the way we do that. And then we'll establish the rules for read and write based on if the user is logged in or not.
So that means that in order to read or write, which we will deal with next, you need to be logged in and have a user id. So we'll do the write this time, like so. Okay. So that basically means that unless you're logged in you won't be able to read or write. In order to read or write you need to be logged in as a user that's pretty much it. So this way you have a nice rule that's set for your database.
And then publish, rules are published, and then if you go back to data you shouldn't have the notification that you need to set up rules before you do any transactions into the database. Okay, now we have all the pieces in place to do crowd operations. So let's get to it in the next video.
- Initializing React Native projects
- Projecting a folder structure
- Installing material kit and vector icons
- Coding a login form and a loader
- Setting up Firebase email auth
- Using the React Native debugger
- Creating a list view, a detailed view, and a menu
- Setting up Redux
- Coding the scroll on detail view
- Adding clickable buttons
- Setting up Firebase for the back end
- Creating the new add person form
- Completing functions