Now for that, I'm back in my code and first of all, we need a server.
Now I won't write my own server-side code because this course of course is not about server-side
technologies like NodeJS,
instead we can use Firebase which is a free-to-use service or free to get started at least, where we
don't need to write any server-side code to still get a server-side API
we can work with.
For that you just need a Google account
and with that on firebase.google.com, you can go to that console and there create a new Firebase
project. Simply click on add project there and give it any name you want, like rn-complete-guide,
any name you like, set this checkmark here and create the project and wait for this to be done which
will be super fast.
Now getting started with Firebase won't cost you anything and you don't need a credit card to get started,
check out the Firebase pricing documentation if you plan on using this in your production-ready application
of course.
So this was created and now we're taken to this newly created app and Firebase actually has a bunch
of services,
it's a fully managed backend which we all won't need,
I just need the database there and that's important by the way,
Firebase sounds like it's a database which we connect to our app.
Actually you never directly connect a cloud database to your application,
instead your application will always communicate with an API,
typically a REST API which then in turn talks to a database because directly setting up a connection
would be insecure.
So that's how we'll do it
and Firebase will give us both a REST API and then a database to which that API talks behind the scenes
without us writing any query code.
Still, we need to enable that database by clicking on database here and there,
make sure you scroll down to the real time database and you click create there, real time database, not
Firestore.
Instead use the real time database and important, start in test mode which makes sure that the rules,
the security rules are set up such that no authentication is required,
we'll change that later to require authentication but for now, we have no users so we will start like
this.
Now this is later where you will see your data which you write to Firebase and its database and this
is the URL or a part of the URL you need to send requests to to store data there or to fetch
data from there
and the cool thing about Firebase real time database is that it kind of gives you a database hidden
behind the REST API where you can target dynamic REST API endpoints which will then automatically
be translated to write or update requests on your database.
So it looks like you're directly talking to a database but you always will talk to a REST API and then
your incoming requests are kind of automatically translated to database queries
you could say. This however is the URL or an important part of the URL we will talk to though.
So with that, this is the URL we'll talk to and why don't we start with making sure that we can actually
create new products and store them there, so that when I submit a new product, we don't just save it
here in memory but we actually send a request to Firebase to store it on its servers.
That is exactly what I want to do here because to me that makes a lot of sense.