Introduction

In this blog, we will discuss Node JS and how to create a Node Project. Node.js is a cross-platform runtime environment and library for running JavaScript code outside the browser.

Before the existence of Node, Javascript code can be run inside the browser. With the invention of Node JS, We can run the javascript code outside the browser as well.

To work with Node js, we need to install Node js in our system.

How to Download Node JS?

  1. Go to Node JS
  2. Download the node js software with respect to your OS and architecture.
  3. Open Node JSinstaller.
  4. Keep the default folder path while installing don't change it. (it will get installed in c://programfiles/node js).
  5. Once installed. Set the node js path in the environment variables section.

Setting environment variables

6. Open the command prompt and type node -version and npm -v to check the node and npm installation.

While installing Node, npm will also get installed.

To check whether Node is installed in your system.

Open command prompt or terminal in case of Mac or Linux.

Type

node -v

Type

npm -v

You will get the version of both Node and npm in your cmd.

Node JS

How to Create a Node JS Project?

To Create a Node Project, first, we need to initialize the Node in the folder of your project.

To initialize a node in your project,

It will ask a few configuration questions regarding the Node project we need to provide answers to it.

Configuration Questions

Node JS

With the answers provided, npm will create a package.json file.

If you want to create a package.json file with default values, type.

npm init -y

Once your package.json file is generated, then you are good to go. You can install any library needed to work in your node js project.

The Package.json file is the heart of the node project. Every project metadata will get stored in the project.json file.

Package.json file is equivalent to a pom.xml file in Java maven technology.

Summary

The blog discusses Node.js and how to create a Node project. Node.js is a runtime environment and library for running JavaScript code outside the browser. To work with Node.js, it must be installed on the system by downloading the software from the Node.js website and setting the path in the environment variables section.