What is Node.js?
• Node.js is a runtime environment that
lets you run JavaScript on the server
side. Built on Chrome's V8 JavaScript
engine. Used for creating fast and
scalable web applications. Open-source
and free to use.
Why Use Node.js?
• Runs JavaScript outside the browser
• Non-blocking (asynchronous) and event-driven
• Great for real-time apps (like chat apps)
• Huge community support and many libraries
• Used by big companies: Netflix, LinkedIn,
PayPal
Features of Node.js
• Asynchronous I/O – fast and responsive
• Single-threaded but highly scalable
• NPM (Node Package Manager) – largest ecosystem of open-source
libraries
• Cross-platform – works on Windows, Mac, Linux
• Built-in modules – like HTTP, File System, etc.
How Node.js Works
• Node.js uses a single-threaded event
loop to handle many connections.
• Instead of waiting, it continues
executing code.
• This makes it non-blocking and fast,
ideal for handling multiple users.
Installing Node.js
1. Go to https://nodejs.org
2. Download the latest LTS
version
3. Install and verify using:
• node -v (for Node.js version)
• npm -v (for NPM version)
Writing Your First Node.js
Program
• After installing Node.js, you can write a simple program.
• This helps you test if everything is working correctly.
• You’ll learn how to write a message and run it using the
command line.
• It’s the first step toward understanding how Node.js executes
JavaScript.
What are Node.js Modules?
• Modules are like building blocks in Node.js.
• They help you organize your code better.
• Some modules are built-in, like reading files or creating web
servers.
• You can also create your own modules or use modules shared by
others.
Creating a Basic Web Server
• One powerful use of Node.js is to create web servers.
• A web server responds when someone opens your website.
• You can control what it shows and how it behaves.
• This is the foundation of backend web development.
What is NPM (Node Package
Manager)?
• NPM comes with Node.js and lets you install extra tools or libraries.
• These tools help you build applications faster.
• It’s like an app store, but for developers. Millions of ready-made
packages are available for different purposes.
Real-World Uses of Node.js
• Chat Applications – like real-time messaging.
• Streaming Services – such as music or video platforms.
• Web APIs – that connect different apps together.
• Data Dashboards – for tracking performance or analytics.
• IoT Devices – controlling smart gadgets.