WEBVTT

00:03.790 --> 00:05.020
Hey, did everyone they.

00:05.020 --> 00:05.350
Sure.

00:05.350 --> 00:08.230
And in this video we're going to work through with the user model.

00:08.230 --> 00:13.060
The user model in itself is going to be probably the shortest of this model that we have taken down

00:13.060 --> 00:18.040
in the previous of the sections we have gone through like insane, crazy, everything that can be possibly

00:18.040 --> 00:18.670
done in the model.

00:18.670 --> 00:21.130
So compared to that, this is going to be rather easier one.

00:21.310 --> 00:22.690
So let's go ahead and do that.

00:22.690 --> 00:24.460
First, I'll create a new folder here.

00:24.460 --> 00:29.110
I'm going to call this one assembly model and inside this one we're going to go ahead and create a new

00:29.110 --> 00:32.470
file and call this one as simply user as now.

00:32.470 --> 00:33.820
This will have just three properties.

00:33.820 --> 00:35.200
So let's go ahead and quickly do that.

00:35.200 --> 00:38.140
We have worked through so many of them shouldn't be a big deal.

00:38.140 --> 00:42.400
And no, I'm not going to be explaining each line of this one because, you know, majority of them.

00:42.520 --> 00:47.500
So we're going to go ahead and say this is a regular stuff we do all the time and now we need to create

00:47.500 --> 00:47.950
a schema.

00:47.950 --> 00:50.320
So we're going to go ahead and call this one as schema.

00:50.320 --> 00:58.210
The schema is going to become from new mongoose dot schema, come on dot schema and there we go.

00:58.210 --> 01:04.180
It requires a property to be injected up here and at the end of it we always do is module dot export.

01:04.180 --> 01:09.760
We have done it so many times now that this should be like next to you that you can do it in the sleep.

01:09.760 --> 01:14.290
Now what we're going to call this one user, but we know what's going to happen in the database as well.

01:14.290 --> 01:16.180
What schema to follow is the user schema.

01:16.180 --> 01:19.180
Now let's go ahead and inject some values into this schema as well.

01:19.300 --> 01:20.350
So not too much.

01:20.350 --> 01:23.500
We're going to have a simple name that is going to be a simple string.

01:23.500 --> 01:25.330
So that is also fine for us.

01:25.330 --> 01:27.550
We're going to go ahead and keep the Google ID as well.

01:27.550 --> 01:29.140
That is also going to be a type of string.

01:29.140 --> 01:30.370
Do we need a Google ID?

01:30.400 --> 01:31.180
Probably not.

01:31.180 --> 01:34.840
But since it's going to come in, I'll just show you that how we can save it.

01:34.840 --> 01:39.010
Maybe you'll have a Facebook ID, Google ID and Twitter ID, whatever you want to store.

01:39.040 --> 01:42.820
You can actually go ahead and do that based on what information is coming in.

01:43.030 --> 01:45.550
After that, we are going to have this email as well.

01:45.580 --> 01:51.310
There are a couple of issues with the email validations and in this case, especially when passport,

01:51.310 --> 01:52.870
gas is injected and all of that.

01:52.870 --> 01:55.240
So this can actually go a little bit of the sideways.

01:55.240 --> 01:57.550
So I would love to walk you through with that as well.

01:57.700 --> 02:00.640
But in this case, we'll talk about that later on.

02:00.640 --> 02:04.480
Right now, this is the this is the exact model that I have three properties.

02:04.480 --> 02:06.940
Just name Google ID and the email.

02:06.940 --> 02:09.400
That's all I'm having in my database itself.

02:09.520 --> 02:12.010
And you can mark all of them as required and everything.

02:12.010 --> 02:12.790
That's up to you.

02:12.790 --> 02:13.690
I'm not going to do it.

02:13.690 --> 02:15.340
So this is the basics of it.

02:15.460 --> 02:20.560
Now let's go ahead and work on the index or JS because we haven't actually touched that part.

02:20.650 --> 02:23.740
So let's go ahead and first bring in our Express.

02:23.740 --> 02:30.850
So we're going to go ahead and say, hey Express, that is going to be coming up from require just like

02:30.850 --> 02:34.360
that EXPRESS We need to create an app from this.

02:34.360 --> 02:36.730
EXPRESS So let's go ahead and call this one as app.

02:36.730 --> 02:41.740
And that is going to be simply express just like that created from express itself.

02:41.950 --> 02:44.710
And at the very end of it, this app needs to listen.

02:44.710 --> 02:50.830
So this app is going to say, Hey, I need to listen on the port 4000, and all that's going to do is

02:50.830 --> 03:03.880
simply have a console log that is going to be saying server is running at running at Port 4000 and of

03:03.880 --> 03:05.830
course, three dots just like always.

03:05.830 --> 03:08.980
Now let's go ahead and see if the Node one is having any issues or not.

03:08.980 --> 03:13.510
So we're going to go ahead and say end PM, run dev.

03:13.510 --> 03:14.260
There we go.

03:14.890 --> 03:17.020
And hopefully it crashed.

03:17.020 --> 03:18.820
It says, hey, there are some issues.

03:19.840 --> 03:23.470
So this is a 4000 ad, it should be something like this.

03:23.470 --> 03:27.040
So let me just go ahead and cut this console log a little bit too much of hurry.

03:27.400 --> 03:29.080
Cut that and this is a callback.

03:29.080 --> 03:35.200
So this goes like that should be all happy now and still crashes out.

03:35.680 --> 03:37.060
Okay, so I got the problem.

03:37.060 --> 03:39.370
It was not nothing big at the time.

03:39.370 --> 03:45.010
When I showed you the demo, that machine was already running, that console was already running and

03:45.010 --> 03:46.480
that is why it was creating the problem.

03:46.480 --> 03:51.880
So all I had to do is shut down whatever was running at the port 4000 or change this one and now it

03:51.880 --> 03:54.310
is all running really, really the smallest of the issue.

03:54.310 --> 03:56.620
But wanted to show you that, yeah, these things also happen.

03:56.800 --> 03:59.410
Now let's go ahead and work on with some of the routes as well.

03:59.410 --> 04:04.300
So first and foremost, we're going to go ahead and say AppKit and what's going to serve on the home

04:04.300 --> 04:04.960
route.

04:04.990 --> 04:08.350
Now, on the home route, I want to serve some of the Edge's template.

04:08.350 --> 04:12.070
And in order to do so, I have to first mention that I'm going to be using edges.

04:12.070 --> 04:16.300
So for that, we have done this once in the past that we have to set up view engine for that.

04:16.300 --> 04:18.190
So we're going to go ahead and save you engine.

04:18.190 --> 04:19.060
What is your view?

04:19.060 --> 04:23.320
Engine Edge's In this case, which is of course going to go inside the code.

04:23.350 --> 04:24.040
There we go.

04:24.220 --> 04:28.930
Now, once I have done this one, now I can say that, hey, I want to render something on this home

04:28.930 --> 04:30.730
route, so let's go ahead and do that.

04:30.850 --> 04:34.270
So just like always, we do request and response, just like that.

04:34.270 --> 04:35.200
And there we go.

04:35.200 --> 04:39.640
And we're going to say, Hey, raise, please render a home page here.

04:39.640 --> 04:44.200
So we're going to go ahead and say Home just like this, okay, this home page doesn't exist.

04:44.200 --> 04:46.600
So obviously it's going to create some issues for us.

04:46.600 --> 04:48.340
Let's go ahead and fix those issues.

04:48.340 --> 04:49.630
Let's create a new folder.

04:49.630 --> 04:55.060
IDs always expect that there is going to be directory views and inside this directory we are going to

04:55.060 --> 04:57.740
have home dot edges.

04:58.660 --> 04:58.880
Okay.

04:58.930 --> 05:01.690
I'm going to go ahead and just pop up the basic.

05:02.090 --> 05:05.990
A basic kind of a boilerplate code up here.

05:06.170 --> 05:08.720
But I would also like to make it a little bit beautiful.

05:08.720 --> 05:10.070
Not too much, but a little bit.

05:10.070 --> 05:13.940
So we're going to go back on to the Google and we'll search for Bootstrap.

05:15.080 --> 05:19.370
Bootstrap five, of course, copy this.

05:19.790 --> 05:21.560
And this is the link that I want.

05:21.560 --> 05:22.070
That's it.

05:22.070 --> 05:23.660
We can now even close down this one.

05:23.660 --> 05:25.430
We don't need much more than this one.

05:25.580 --> 05:29.510
So let's go ahead and inject this one and there we go.

05:29.510 --> 05:31.010
So now this is all good.

05:31.040 --> 05:36.080
Now, the advantage of this is I can come inside the body as well and can mention a few of the classes.

05:36.080 --> 05:41.960
For example, I can say BG Dash Dark and I can say text Dash White.

05:41.960 --> 05:46.280
Now what this is going to do, this is going to make the entire body as something which is much more

05:46.280 --> 05:47.780
easier to watch and view.

05:48.080 --> 05:51.110
And further down the road we're going to have a container.

05:51.110 --> 05:57.590
So let's go ahead and say def dot container and on the container we are going to go ahead and simply

05:57.590 --> 06:04.160
put up a simple H1 that's going to say AE social login.

06:04.160 --> 06:04.970
There we go.

06:05.210 --> 06:08.660
And once I have this one, I would need two more containers up here.

06:08.660 --> 06:13.220
First, let's see that how much this is actually sort of serving or not save this one.

06:13.220 --> 06:14.090
Looking good.

06:14.120 --> 06:19.310
Now let's go on to the local host, 4000 to see if everything is working fine or not.

06:19.310 --> 06:20.480
We can use this one.

06:20.840 --> 06:23.540
So we're going to say localhost, 4000 and there we go.

06:23.540 --> 06:25.940
AE social login in the dark board by default.

06:25.940 --> 06:26.930
This is looking good.

06:27.200 --> 06:28.520
Now let's also go ahead.

06:28.520 --> 06:32.990
And since this is not a complex work, let's go ahead and make three copies of this one.

06:33.110 --> 06:34.550
So one, two.

06:35.210 --> 06:38.870
Now the third copy is going to just have a class of this one.

06:38.870 --> 06:43.250
So we're going to go ahead and inject a class of displayed dash one.

06:43.340 --> 06:45.260
And here we are going to just say.

06:46.010 --> 06:47.030
This is a home page.

06:47.030 --> 06:52.910
So you are at kind of a capital of home page.

06:53.390 --> 06:55.310
And in here this is the container.

06:55.310 --> 06:57.890
So we're going to have a couple of tags up here.

06:57.890 --> 07:00.770
So let's go ahead and say we are going to have a tag.

07:00.770 --> 07:10.700
This a tag will have a class of BTN, another class of BTN and outline the success and we need three

07:10.700 --> 07:11.090
of them.

07:11.090 --> 07:13.460
So we're going to multiply it by three and there we go.

07:13.460 --> 07:15.320
So let's go ahead and save this one.

07:15.620 --> 07:20.510
This is right now not going to go anywhere, but let's go ahead and make them on each and separate line

07:20.510 --> 07:22.160
so it's much more easier to see.

07:22.160 --> 07:25.190
And by the way, I'm using image shortcuts in case you don't like them.

07:25.190 --> 07:26.660
That's totally fine as well.

07:26.990 --> 07:35.240
So let's go ahead and say this one is going to be simply log out, this one is going to be simply log

07:35.240 --> 07:39.080
in and this one is going to be simply home.

07:45.610 --> 07:46.630
That we are having.

07:46.630 --> 07:47.530
Let's go ahead and see.

07:47.560 --> 07:48.460
Save that.

07:48.790 --> 07:51.100
Hit a save here on the index or GPRS as well.

07:51.100 --> 07:53.230
And let's go ahead and reload how this is looking up.

07:53.230 --> 07:54.580
So this says you are at home page.

07:54.610 --> 07:55.390
Really nice.

07:55.390 --> 07:59.800
We have this log out, log in and the home page, this is looking absolutely fine.

07:59.800 --> 08:03.940
Right now I'm able to visit home page, log in and log out are not going anywhere.

08:03.940 --> 08:09.610
That is absolutely fine as of now, this case and I guess this is all what we wanted to do for this

08:09.610 --> 08:10.570
particular video.

08:10.600 --> 08:14.710
Let's go ahead, move on to the next video and talk about some more routes that we are going to set

08:14.710 --> 08:14.950
up.

08:14.950 --> 08:16.000
But in the next video.
