A Friendly Introduction To Node Js - 🙏 Namaste Node Js

0
Getting Started with Node.js: A Friendly Introduction

Lets Begin With Node Js

Node.js Overview

1. What is Node.js?

Think of Node.js as a tool that lets you use JavaScript on the server side. Traditionally, JavaScript was only used in browsers (for the front end), but with Node.js, you can now build the backend of your applications using JavaScript too. This makes life easier since you only need to know one language for both the front and back ends of your project.

2. How to Install Node.js

Getting Node.js set up on your computer is pretty straightforward:

Download Node.js: Head over to nodejs.org and download the installer that matches your operating system (Windows, macOS, or Linux).

Install Node.js: Run the installer and follow the instructions—it’s just like installing any other software.

Check the Installation: To make sure Node.js is installed correctly, open your terminal (or Command Prompt if you’re on Windows) and type:

node -v

This command will show the version number if Node.js is installed properly. If you see a number, you’re good to go!

3. Testing Node.js by Installing a Package

To make sure everything’s working, let’s install a package called Express. Express is a popular framework for Node.js that helps you build web applications.

Install Express: Open your terminal and type:

npm install express

NPM (Node Package Manager) is included with Node.js and helps you install and manage packages.

Check for Errors: If the installation completes without errors, then Node.js is installed correctly. If you run into issues, you might need to revisit the installation process.

4. Understanding the Files Created

When you install a package like Express, a few important files are created:

node_modules: This folder holds all the packages that your project can use.
package.json: This file contains details about your project, like its name and version, and lists all the packages (dependencies) your project needs.

Simply put, dependencies are the packages your project relies on.

package-lock.json: This file locks in the exact versions of each package so that your project is consistent, no matter where it’s installed.
Node.js Files Overview Github Repo - 15 Days Node Js Workshop

5. Understanding Versioning

In Node.js, packages use Semantic Versioning (SemVer), which follows this pattern: Major.Minor.Patch (e.g., 4.90.2).

Major Version: Changes when there are big updates that might not be compatible with older versions.

Minor Version: Changes when new features are added in a way that’s compatible with previous versions.

Patch Version: Changes when bugs are fixed.

All three parts (Major.Minor.Patch) are required for a valid version, so something like 2.1 isn’t enough.

And that's it! You’re now equipped with the basics of Node.js—happy coding!

Post a Comment

0Comments
Post a Comment (0)
To Top