Hi everyone.
In this video let's add the validation in the next JS.
Okay.
For example, inside the authentication right here when we sign up and when we sign, we need to add
a little bit of validation into the video.
Okay.
First of all, inside the signup video we need to add a bit of validation.
First of all right here we need to mask for example like firstly let me go to the validation bit from
the list over here and make sure we install this package.
And let's scroll down a little bit in order to enable Enabled validation.
We need to use this line right here.
Let me copy.
Isn't mine.
Not the.
Yes, we will enable us.
Okay, so you see this line?
If not, it will not work in here.
We can use some validation rule.
For example, if mail.
Is not empty.
Is or is emails.
Right?
Let me do that.
For example inside here I will use the is not empty.
We will import not from class validator.
Is email over and over here we is not apply also.
now let's say.
It's a missile.
Furthermore, if I remove the name, you can say it will or not.
If I say, well, we will log the message error and bad request error will be name should not be empty.
Very very cool right?
And for more detail you can always check out this thing.
You can say you can read more about us.
It will have something like here okay.
It will also provides most of the validator.
We can use that without need to customize.
And of course we can customize the message.
For example, right here both the object with the message okay.
But right now I think the message right here, it will be very enough for both of case.
I will not customize anything.
And let me go to the side also we need the user is email.
And is not.
Empty okay.
Furthermore if I put the invalid email.
Let me say now you can say email me an email.
Right.
So.
I think that will be enough.
And we will ask one more thing.
Is that the authentication service, when we sign up we want to make sure the email should be unique.
Right.
Okay.
So right now let me show you how we can do that.
I will just use my email gateway this dot.
User module .5115 find my email?
Okay.
If we have a user by email, we will throw.
New bug requests, etc..
You may email.
Already in use like does.
Let me sign up.
Now email already in use.
Very good.
So I think that will be enough for the validation.
And for more detail please check out the documentation.
Okay, I will see you in the next one.