Hey, did everyone.
They sure.
And welcome to another section.
Now, in the previous section, we have a lot of discussion majorly about the theory that how we are
going to actually make this project up and running.
We came up with the three models that we discussed in detail, in depth in this one.
We're going to get started with the code itself.
So first thing is we need to design a simple basic app from scratch, of course, and we need to create
some folders in that.
That's exactly what we'll be doing.
After that, we'll be installing some of the libraries, majority of the libraries we have already explored
in the course throughout the journey.
There is just only new one.
New one which we are going to explore in this video.
It's really, really simple one.
We won't be using it extensively in this application, but I thought to just introduce it because so
many of the kind of pro grade application uses this a lot.
So just wanted to introduce you that otherwise entire to this this application can work without that
library as well.
So let me go ahead and first bring up my code editor, not code editor, my terminal itself.
Let's go ahead and see all of our applications are there so far.
So let's go ahead and create another directory.
So we're going to go ahead and say, hey, I want to create a directory.
Let's call this one as my shopping.
My shopping or a t shirt store?
T shirt store.
Yeah, it seems like a reasonable name, but feel free to change the name.
This is not going to bother us and there is an extra edge there.
So it should be like t shirt.
There we go nicely.
So t shirt store.
So this is all what we got.
Let's go ahead and do that now.
Let's go ahead and migrate into that.
So let's go into t shirt store and we're going to go ahead and say, hey, I want to initialize it.
This time we will be making all the initial questions that are being answered.
Question to us.
So what is the name of this one?
Package name t shirt store is fine to me version fine to me description.
So a backend API for t shirt store and entry point indexed or JS is absolutely fine because that's what
exactly my index point entry point is going to be test command.
We are not talking about any kind of testing suite here.
Git repository, not right now.
This one is going to be simply API and backend would be defined as a keyword.
Yeah, that's that's look good.
Great author.
Of course I'm going to go ahead and put up my name if I can write that correct license.
All Fine, this is all okay, let's go into this one.
So let's go ahead and quickly see an LZ s package or JSON file is here.
Now let's go ahead and install a few libraries and then we're going to create some of the folders here
as well.
So I'm going to go ahead and say, hey, I want to go ahead and install a few libraries.
Now notice very carefully I'm going to go ahead and say I need a big script.
JS Now can you tell me why we need backup?
JS In case you have already gone through with the previous section, you know that we need to store
the password in, in the encrypted format, not clear text and B script.
G actually helps us to do this.
Can we do it with the default installation of the crypto JS which comes up right out of the box in the
in the node?
JS No, we cannot.
This is much more friendlier version.
Now, apart from this, we will be uploading the images.
So we're going to need cloud ordinary and we have already got a huge in depth detail talk about the
cloud binary.
So we're going to be working on that.
So this is cloud ordinary?
Yeah, it seems.
Okay, I might make a few typos in that.
That's a kind of a habit that I do.
Okay.
We will also need a cookie parser and you might be wondering why we are going to need that.
We will be sending the JSON token in all of the web application as HTTP only read only cookies.
That's where the cookie parser is going to come in because I also want to read those cookies.
So that is how we are going to do that.
Dot and V is going to come in handy.
Obviously, you know that I won't be discussing it again, of course, without a doubt.
EXPRESS And another one, the brother of Express, which is express file upload.
So let's go ahead and say express file, upload, upload.
There we go.
We will be talking through the database as well.
And our choice of Aurum for this one is going to be Mongoose, not Aurum ODM.
But again they are kind of A1 are the same in the, in the kind of vague definition.
Now of course after that we are going to need a JSON web token because obviously we'll be working with
the tokens and all of that.
So that is there.
We have already discussed that we will be working with the node mailer.
We haven't gone through with the practical demonstration itself that we'll be doing in this one.
But Node Miller you already know why this is going to be useful for us.
We will be going with the strife.
We will be going with.
Razer pay as well.
Razer pay.
I'll be injecting both of them.
Feel free to pick any one of them or just keep the both however you like.
We will be going with the both of them.
Okay, so stripe razer pay the new addition.
Here is a validator.
Now, this is something that we haven't worked on.
We haven't talked about it, but these are the basic libraries.
In case I missed any.
I will come back and will install later on all of that.
Now, this is getting all installed.
In the meantime, we can go ahead and kind of explore this validator that why we need in this one on
the very first place.
Now, what you are going to notice in the documentation of validator there.
It is used to just simply validate some of the things that are coming to you.
Maybe somebody has passed you a string and you want to check whether that string is email or not.
You can do that by your own regular expressions or you can use something like Validator to extract that.
Now, one of the best thing about the validator, of course, it is really popular, but one of the
best thing that I like about the validator is you can also verify if the data you are is coming to you
or not.
So if I go ahead and scroll a little bit, there we go.
So sometimes you don't know whether the person who is sending you the files are coming up as just file
name itself or they have worked through with some kind of processing on the front end.
So that data comes to me.
So you can also check that in case you want to go ahead.
And this is one of my favorite options in this entire library, but feel free to use something for more
that whether it is a credit card or not, whether it is alphanumeric, whether it is email or not.
So it gives you right out of the box a whole lot of thing.
Yes, there is an argument around as well that this is too overkill and you should not use that.
This is too heavy of a library.
Again, it depends on what you really want to do and how much validation you want to put in.
So that's the basic of it.
So it looks like a whole lot of libraries are included up here.
Some are being deprecated.
No big issue.
They are still very popular and are being used quite a lot.
Okay.
If I go ahead and do list, these are all up here, nice and easy.
Now I want to go ahead and create a couple of directories and for that I'll be using this same thing.
Config Controller, Middleware Module.
So it is a little bit better and easier for me to just create them right from here.
So I'm going to go ahead and move this a little bit.
It's not so config controller middleware.
Let's go ahead and create that.
So first one is going to be config.
Then we need a a folder for controller.
Then we are going to need another folder for middleware and then we are going to need one for models
of course, let's call it as model or models.
Yeah, whatever.
Doesn't really matter.
And then we need something for roots.
And what else do we got?
Then we need.
We won't be working with the seeds.
We'll be working with Utils for sure.
And that's it.
So Utils, now it is for me a little bit convenient to work with the command line directly up here in
case you are not comfortable.
Go ahead.
Right click and click.
Create all of them.
I find it much more easier and kind of a workable here.
Okay.
So controller middleware and let's call it as model as well instead of models, because everything we
are going with the singular or we can go all of that with the plurals.
So controllers and the middleware is not going to bother you anything.
It's your own personal preference and how your company is instructing you.
So go ahead and use that.
Okay, this is all done.
So we should have all the folders up here.
Okay, nice.
I'm going to go ahead and create my files as well.
The first one is indexed or JS and another one is going to be app JS and Dotti and V and all of that.
We're going to create via the code editor itself.
So let's go ahead and fire up the code.
I know this is a little bit of too much that we have done just via the command line, but I absolutely
love that it gives me a better structure and I don't accidentally put up folders inside each other and
all of that.
So whenever I do that, I use this kind of structure.
So right now everything is empty and that's how it's supposed to be.
So there we go.
And let's check out the package store JSON.
Okay, it looks nice and we have all the keywords and all of that.
So looking absolutely fantastic.
Now moving further, what we're going to do, let's install a dependency for the development mode also.
So I'm going to go ahead and say NPM, install a development dependency, which is Node one.
I will be using Node Bond quite a lot, so we'll be working with that.
Okay.
So this is all good.
This reminds me that we might be needing some kind of logger as well.
So let's go back up here and let's go ahead and see if we can find some of the logger here.
So let's go ahead and say, hey, I need a logger.
You definitely can use something like Winston and all of that, but I'll be going with the Morgan because
that sounds easier for me.
So let's go ahead and install Morgan as well.
Now again, this is totally 100% optional.
I just kind of remembered them.
So let's go ahead and say, Hey, I want to install this is too much.
Okay, let's go ahead and install that and PM install Morgan.
There we go.
Okay.
So these are the basic libraries that we have as of now.
Currently, in my mind, if we are going to see anything else, we are definitely going to come back
here and will install a little bit more.
Okay, that's it.
In the next video, we're going to make sure our our server is up and running.
Let's go ahead and catch up in the next video.