- [Instructor] Let's get started with building
our node express project first.
So first, we'll initialize a new node project
that installs some dependencies,
and finally add the files from a project built
in my node and express API course in the LinkedIn library.
So before we get started with our base project,
if you don't have MongoDB installed,
please go to their website on mongodb.com
and install it, as we'll need it to run the new project.
If you need help installing it,
go through their video on the subject
in the same course I just mentioned.
When you have it installed, come back to this video,
and I'll wait for you.
When you're ready to make sure
your Mongo database is running,
you can test it with a tool called Compass
that is directly on the MongoDB site.
So you can install Compass, and then once you have Compass
installed, you'll be able to see if the database is working.
So let's take a look at Compass, and it looks like this.
So when you run Compass, it basically asks you to
connect to the database on your system,
and if it's a successful connection,
you're going to see the database that are available
on that local host, port 27017.
So eventually when we run our application,
you're going to see the database that is related
to that application appear on Compass.
You can also use a tool that I've used a lot in the past
called Robo T, but Compass does the same job
across Windows and Mac, so feel free to use Compass
or any other tools that you use to test your database.
All right, so let's switch to VS Code now.
So what I'm going to do first, before we actually open
VS Code, I'm going to create the folder
where we'll install and add the files for our project.
So I'm going to go on the desktop and right click,
create a new folder, and I'm going to call this one Security.
And once you have it installed,
what you can do is drag and drop it
directly on VS Code, like so, and on Windows,
you can right click on the folder
and open it inside of VS Code.
Now we have the folder inside of VS Code,
and we can start installing the dependencies
directly inside of that folder.
So let's go ahead and bring up the terminal
so you can go on terminal and click on
new terminal, like so.
And then let's go ahead and install the dependencies.
So what I'm going to do first is do an NPM in it,
so I initialize a new project inside of that folder
with node, and then I'm going to use the double ampersand
to add the dependencies directly inside of
our package.json file.
So the double ampersand, if you're not familiar with it,
allows us to run a command first,
and then once this command is executed,
run the second one.
If you want to run all the commands at once,
you can use the single ampersand.
But for this case, it's not going to work
because we need to initialize our node project first
before we install the dependencies.
So what we're going to install on that project,
let's go and do NPM install.
And the ones that we need to install is first body parser,
then we need to install express,
mongoose,
nodemon,
and then let's do the double ampersand again,
and we're going to install the dev dependencies,
so let's do NPM install, or you can do the I
for shortening the install if you want to.
And I'm going to do dash dash save dash dev,
and these are the dependencies that I want to install
on the dev side, the first one is babel
dash CLI,
then babel dash preset
dash
environment, so ENV.
The last one is babel dash preset dash stage dash zero.
So once you have all this typed,
go ahead and hit return, and it's going to initialize
your project first, so you can answer
all the default questions.
I'm going to return on most of 'em.
And I'm going to type my name for author.
And then, yes.
And then what's going to happen after that,
because we used the double ampersand,
it's going to first install all the regular dependencies,
and then the dev dependencies.
And now, you can take a look at the package.json file
by clicking on it.
And you're going to see the dependencies
that we've installed here, and then
the dev dependencies that we've installed.
Perfect.
So now, what we need to do is copy the files
from the original project that I created
in the other course, so let's go back to our desktop,
and I'm going to open the exercise files.
Click on resources, project, and then copy all the files
that I have on that folder inside of the project.
Just make sure that you're seeing the babel RC file.
If you don't, your system is not showing hidden files.
So if you don't see it, do a search in Google
and find out how to show hidden files in your system.
But make sure you copy this file,
because if you don't, your project is not going to work.
So you need to have that file.
So let's copy these files, and then put them
inside of the security folder by doing command V, or paste.
And I have all my files inside of that project.
So now that we have our dependencies installed,
let's move on.