Hey, did everyone they.
Sure.
And in this video we're going to work through with the user model.
The user model in itself is going to be probably the shortest of this model that we have taken down
in the previous of the sections we have gone through like insane, crazy, everything that can be possibly
done in the model.
So compared to that, this is going to be rather easier one.
So let's go ahead and do that.
First, I'll create a new folder here.
I'm going to call this one assembly model and inside this one we're going to go ahead and create a new
file and call this one as simply user as now.
This will have just three properties.
So let's go ahead and quickly do that.
We have worked through so many of them shouldn't be a big deal.
And no, I'm not going to be explaining each line of this one because, you know, majority of them.
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
a schema.
So we're going to go ahead and call this one as schema.
The schema is going to become from new mongoose dot schema, come on dot schema and there we go.
It requires a property to be injected up here and at the end of it we always do is module dot export.
We have done it so many times now that this should be like next to you that you can do it in the sleep.
Now what we're going to call this one user, but we know what's going to happen in the database as well.
What schema to follow is the user schema.
Now let's go ahead and inject some values into this schema as well.
So not too much.
We're going to have a simple name that is going to be a simple string.
So that is also fine for us.
We're going to go ahead and keep the Google ID as well.
That is also going to be a type of string.
Do we need a Google ID?
Probably not.
But since it's going to come in, I'll just show you that how we can save it.
Maybe you'll have a Facebook ID, Google ID and Twitter ID, whatever you want to store.
You can actually go ahead and do that based on what information is coming in.
After that, we are going to have this email as well.
There are a couple of issues with the email validations and in this case, especially when passport,
gas is injected and all of that.
So this can actually go a little bit of the sideways.
So I would love to walk you through with that as well.
But in this case, we'll talk about that later on.
Right now, this is the this is the exact model that I have three properties.
Just name Google ID and the email.
That's all I'm having in my database itself.
And you can mark all of them as required and everything.
That's up to you.
I'm not going to do it.
So this is the basics of it.
Now let's go ahead and work on the index or JS because we haven't actually touched that part.
So let's go ahead and first bring in our Express.
So we're going to go ahead and say, hey Express, that is going to be coming up from require just like
that EXPRESS We need to create an app from this.
EXPRESS So let's go ahead and call this one as app.
And that is going to be simply express just like that created from express itself.
And at the very end of it, this app needs to listen.
So this app is going to say, Hey, I need to listen on the port 4000, and all that's going to do is
simply have a console log that is going to be saying server is running at running at Port 4000 and of
course, three dots just like always.
Now let's go ahead and see if the Node one is having any issues or not.
So we're going to go ahead and say end PM, run dev.
There we go.
And hopefully it crashed.
It says, hey, there are some issues.
So this is a 4000 ad, it should be something like this.
So let me just go ahead and cut this console log a little bit too much of hurry.
Cut that and this is a callback.
So this goes like that should be all happy now and still crashes out.
Okay, so I got the problem.
It was not nothing big at the time.
When I showed you the demo, that machine was already running, that console was already running and
that is why it was creating the problem.
So all I had to do is shut down whatever was running at the port 4000 or change this one and now it
is all running really, really the smallest of the issue.
But wanted to show you that, yeah, these things also happen.
Now let's go ahead and work on with some of the routes as well.
So first and foremost, we're going to go ahead and say AppKit and what's going to serve on the home
route.
Now, on the home route, I want to serve some of the Edge's template.
And in order to do so, I have to first mention that I'm going to be using edges.
So for that, we have done this once in the past that we have to set up view engine for that.
So we're going to go ahead and save you engine.
What is your view?
Engine Edge's In this case, which is of course going to go inside the code.
There we go.
Now, once I have done this one, now I can say that, hey, I want to render something on this home
route, so let's go ahead and do that.
So just like always, we do request and response, just like that.
And there we go.
And we're going to say, Hey, raise, please render a home page here.
So we're going to go ahead and say Home just like this, okay, this home page doesn't exist.
So obviously it's going to create some issues for us.
Let's go ahead and fix those issues.
Let's create a new folder.
IDs always expect that there is going to be directory views and inside this directory we are going to
have home dot edges.
Okay.
I'm going to go ahead and just pop up the basic.
A basic kind of a boilerplate code up here.
But I would also like to make it a little bit beautiful.
Not too much, but a little bit.
So we're going to go back on to the Google and we'll search for Bootstrap.
Bootstrap five, of course, copy this.
And this is the link that I want.
That's it.
We can now even close down this one.
We don't need much more than this one.
So let's go ahead and inject this one and there we go.
So now this is all good.
Now, the advantage of this is I can come inside the body as well and can mention a few of the classes.
For example, I can say BG Dash Dark and I can say text Dash White.
Now what this is going to do, this is going to make the entire body as something which is much more
easier to watch and view.
And further down the road we're going to have a container.
So let's go ahead and say def dot container and on the container we are going to go ahead and simply
put up a simple H1 that's going to say AE social login.
There we go.
And once I have this one, I would need two more containers up here.
First, let's see that how much this is actually sort of serving or not save this one.
Looking good.
Now let's go on to the local host, 4000 to see if everything is working fine or not.
We can use this one.
So we're going to say localhost, 4000 and there we go.
AE social login in the dark board by default.
This is looking good.
Now let's also go ahead.
And since this is not a complex work, let's go ahead and make three copies of this one.
So one, two.
Now the third copy is going to just have a class of this one.
So we're going to go ahead and inject a class of displayed dash one.
And here we are going to just say.
This is a home page.
So you are at kind of a capital of home page.
And in here this is the container.
So we're going to have a couple of tags up here.
So let's go ahead and say we are going to have a tag.
This a tag will have a class of BTN, another class of BTN and outline the success and we need three
of them.
So we're going to multiply it by three and there we go.
So let's go ahead and save this one.
This is right now not going to go anywhere, but let's go ahead and make them on each and separate line
so it's much more easier to see.
And by the way, I'm using image shortcuts in case you don't like them.
That's totally fine as well.
So let's go ahead and say this one is going to be simply log out, this one is going to be simply log
in and this one is going to be simply home.
That we are having.
Let's go ahead and see.
Save that.
Hit a save here on the index or GPRS as well.
And let's go ahead and reload how this is looking up.
So this says you are at home page.
Really nice.
We have this log out, log in and the home page, this is looking absolutely fine.
Right now I'm able to visit home page, log in and log out are not going anywhere.
That is absolutely fine as of now, this case and I guess this is all what we wanted to do for this
particular video.
Let's go ahead, move on to the next video and talk about some more routes that we are going to set
up.
But in the next video.