How to Create First Node Project?

Deepali Kalagate
3 min readDec 10, 2020

--

Node.js is one of the most important tools to have in today’s software world. Let’s see what is Node.js…

What is Node.js?

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. It is a Server-Side Scripting Framework, this means that Node.js is used for backend development and runs on the server. Now that we have an overview of Node.js, let’s start building our first project. Let’s install node first.

We can install node using below command…

Node comes with Node Package Manager (NPM) — NPM which is super useful and is used to manage project dependencies. To start with Node you need to install npm. To install npm run the following command…(assuming your OS is MAC)

Now test that you installed node and npm properly by running the following commands…

Now we will use npm to create our first node project. First, let’s create our project directory, then we will run the init command…

Follow the command line prompt and you can leave everything as the default, then it will ask you in the end if everything looks ok.. then click on yes.

Your directory should look something like this..

_firstNodeProject__package.json

The package.json file consists of all the project settings and other npm package dependencies. If you open the package.json it should look like this…

The “name” element is the name of your project, in our case it’s “firstNodeProject”. The “main” element specifies the file that acts as your entry point when you run your project. As you can see, we don’t have the index.js file in our project directory. So now we create that file using the following command…

Now we can safely run our project. It is as simple as running the following command…

you can also run your program by using the command “npm start”…

Congratulations!! you have built your first Node.js program.

--

--

Deepali Kalagate
Deepali Kalagate

Written by Deepali Kalagate

0 Followers

Simplicity is the key to happiness

No responses yet