In this video.
Let's get started with the low level authentication.
So these are the steps.
First is you are going to register a user and after that you are going to use those details to implement
the login functionality.
So let's get started.
Well, I have my user model here, so let's go to the route for registration.
So let's locate the root that is for registration.
There is no root for registration.
This one renders the register form.
So let's copy this one and down here let's pass it and let's change the name here to register the user.
So here are going to be get register form.
Get register form.
So let's focus on the post here.
Here are going to be post requests.
We are going to use Visual City Code extension called ten client to make the HTTP request than using
postman.
So if you don't have this extension, go ahead and install.
It is called tender client if it's set for tender client.
And this is what I installed.
That is it.
So let me collapse it.
And now let's go ahead and create a collection.
So let's create one collection.
I'll click here and call this one collection and the name going to be the authentication.
So inside the collection.
So inside the authentication, let's create first request core register and let's provide the you are
going to be at HTTP column four, slide four, slice looker.
Host Cullen 3000 for a slash.
Register and post requests and ask that.
So let's hit send and let's see if you see that it is returning a HTML and indeed it is this one.
This one is written in the HTML.
So let's go ahead and register the user.
Remember, we have the user model here.
So we inside this function or roots.
Let's go ahead and then register the user.
So here we go.
We take the user model.
And on that we are going to use create to create a user and then you pass in the fields that you want
to create.
For this one, we need the full name of the user and we can get it from request, dot, body, dot,
food name and the next property is going to be Let's have a look.
User name, full name, password and image.
So here we go.
After full name, you're going to provide the user name and the same thing.
We can get it from rec dot body.
Dot username.
And lastly, I'm going to be the password also from the rec dot buddy dot password.
But I thought we can structure it from the regular body.
But let's make it as simple as this.
And for the image, we are going to use the default image here.
So we don't need to provide them when you are creating it.
So now this is our create function.
So here, let's handle the premise, then.
Here we go.
We have the user.
And if everything goes well, let's go ahead and then console.log the user.
Is that if something goes wrong let's handle it as that.
And make use of error and console.log.
The.
Error.
Well, for this one we can make use of async await, but let's make it pretty simple here.
So now we have the root.
So let's go ahead and register.
So let's open the ten dot lines and now click collection.
And inside we have this request.
So let's pass in the payload.
So click on body and click on JSON and here we go.
So let's provide the first.
The first one is full name.
And let's call this one as John.
And the person user name.
I'll call this one as Johnny.
I is the person with the name and then the password.
Is going to be one, two, three, four, five.
So now let's hit st.
Now let's have a look where we are not returning any response.
But if you check our terminal, let's check our terminal and see.
So let's open our terminal and let's see that it has been created.
Now click here and I can see that we have the user being created here.
Now we have the user with user name and then the password.
But before we continue, if we want to visualize this document inside our dashboard, we can use what
is called the compass.
So if I refresh it and inside the school and in that I have visa collection and this is a user I created
and better so we can visualize the same code inside our Visual City code.
And this one too.
We've talked about it where we use MongoDB extension to visualize.
So click on this one and then reconnect or connect.
And here we can see our database and collections inside Visual Studio code, how awesome it is.
And here if I open this cool database, I have to use this.
And in there I have one document which is this user and the same has to be see inside Compass.
So I'm going to use this extension to visualize my database, what is going on or better so you can
use what is called the compass.
So now we are ready to go to get started with the log in system.
Then this video.
Let's go ahead and implement the login functionality.