Hey, did everyone.
They sure.
And let's go ahead and talk about one by one all of these problems, starting with the very easiest
one, which is hiding the secret.
You all know, hiding the secret is really important.
And this is how your entire application is going to be safeguarded through the variety of attacks,
as well as some sensitive information that should always be available just with your back and even securely
to your back.
And also and we have seen that in one of the first videos or first section that there is a configurable
section and you'll find this section everywhere.
It's not just about Heroku, it's about digital.
Okay?
And eight of us, they all give you access to some kind of safe storage, which is secure, and your
application just access them through some of these processes.
Now, majority of the time, you're going to see that they always gives you like this process and then
the name of the variable.
And here also you see that the name of the variables are being defined and you just put up the value.
You don't define the port just like we have defined it.
But you saw that we were writing process and now this is the time we study more about in depth of that.
First thing you might have noticed that everything is in the caps, in the config variable part there
is available and there is a value.
So I'm going to call this one as available.
GitHub username is there and there are other variables.
There can be backend URL, there is some secret.
So this is all usually written in the all uppercase, not compulsory, but this is how we majorly do
it.
So how we can go ahead and do this.
Now, there are not too many of the ten options that are being used by the industry majority of the
time.
In fact, like 99.9% of the time you'll be using D and V, you can actually use some of the other packages
or write to custom your own, but it doesn't really make sense to not use what everybody is using.
So this is the package that we'll be using.
So if you'll open up this package, this is the variable of library you are going to see or the package.
And you can see by the weekly download that this is an insanely crazy popular library.
Everybody uses this.
Yeah, this is the popularity of it.
In just week this many downloads and it was published five months ago.
It's not the new one, it's the published date actually when the recent publish of this version was
published.
If you're going to look for the versions, you're going to see that this is like really long popular
library around eight years ago and still to this date.
Well, the most industry standard.
Okay.
Moving back on to this dot envy.
Let's go ahead.
Now, we can install it pretty easily.
We're not going to do it right now.
We'll have a separate starting of the project itself.
Right now, we just want to study the theory part.
So this is the this is that one.
So we're going to just go ahead and grab and PMI or dot, dot, E and V, that's the package name.
That's all you have to install.
And then comes up the part is the usage which is required and v now I'll show you a little bit more
and I'll give you the snippets of that so that you can easily access them via the presentation itself.
But notice here again, as I mentioned that the DB underscore host, this is how the variable name is
being displayed and after that you use just the local host.
Now a couple of things.
Keep in mind that in the value you just write whatever is there, you don't use double codes for string
or anything, a special format for numbers.
You just simply declare all in uppercase by the standards are the name of the variable and by equal
you just use whatever is there.
It can be a string, it can be a URL, whatever is there.
You just paste it directly as it is.
So this is one thing.
Now we also saw that just like we were using a const express equals required express.
Since we don't hold this into a variable, you just need to have this file available.
And once this is available, you can just write processed E and V wherever this is being declared,
you can write a processed E and V and whatever the name of the variable is.
Now notice here it says config, but this config is a little bit more tricky to work on with because
there are a couple of syntax that may come in.
So I want you to just introduce with them.
So majority of the case, if the dot env file, of course you have to create a new file in your project
directory.
We will do this all of the practical, but I just want to make sure your journey is absolutely smooth
with a constant grace grasp over the theory itself.
So you usually write require dot and V as a config, but sometimes in some cases you put that env file
into some special folder, maybe a config folder or something.
In that case, you have to pass on an object in this config and have to say that the path of loading
this environment variable is located up here wherever that path is.
And usually we prefer to put this put this entire path relative to the home directory.
But again, it's up to you.
You want to use dot, dot, slash, go ahead and use that.
There is no issue in that.
Now, there are more options available in this one, but you don't need to know too much about them.
And this actually solves us the problem of hiding the secrets.
So one problem is solved.
Let's go ahead and move on to the next problems that we have.