This repo documents my Node.js learning journey, covering fundamentals, backend development, npm, Express.js, databases, and real-world projects. I'll be building and sharing hands-on exercises, REST APIs, and more. Stay tuned for updates, and feel free to explore or contribute!
Node.js is an open-source, cross-platform runtime environment that allows developers to run JavaScript code outside of a web browser. It is built on Chrome's V8 JavaScript engine and is widely used for building scalable network applications, web servers, and backend services.
- Asynchronous and Event-Driven: Handles multiple operations concurrently without blocking execution.
- Non-Blocking I/O: Efficiently manages operations like file system access, database calls, and networking.
- Cross-Platform: Works on Windows, macOS, and Linux.
- Package Management (npm): Comes with Node Package Manager (npm) for managing dependencies.
- Fast Execution: Uses the V8 engine for high-speed JavaScript execution.
- Visit the official Node.js download page.
- You will see two versions:
- LTS (Long-Term Support): Recommended for most users.
- Current (Latest Version): Includes the latest features but may not be stable for production.
- Download the appropriate version based on your operating system (Windows, macOS, or Linux).
- Open the downloaded
.msiinstaller. - Follow the installation wizard:
- Click Next to proceed.
- Accept the License Agreement.
- Choose the installation directory (default is recommended).
- Select components (keep default selections).
- Click Install and wait for the process to complete.
- Once installed, restart your computer (optional but recommended).
- Open Command Prompt (cmd) or PowerShell.
- Run the following command to check the installed Node.js version:
If installed correctly, it will display the Node.js version.
node -v
- Verify npm (Node Package Manager) by running:
This will show the npm version, confirming that it is installed with Node.js.
npm -v
- Open Terminal and run the following command:
For macOS, you can install Node.js via Homebrew:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejsbrew install node
- After installation, verify using:
node -v npm -v
Now that Node.js is installed, you can start writing JavaScript code!
- Create a new file named
app.jsand add the following code:console.log('Hello, Node.js!');
- Run the script using:
This should output:
node app.js
Hello, Node.js!
- Learn about npm and install packages:
npm install express - Explore frameworks like Express.js
- Build a simple HTTP server using Node.js
Happy Coding! 🚀