
Get Started in NodeJs
Awesome! Let's get you started with Node.js — the right way 🎯
🧱 What is Node.js?
Node.js lets you run JavaScript on the server (outside the browser). It's perfect for building web servers, APIs, real-time apps, tools, and more.
⚙️ Step 1: Install Node.js
Go to https://nodejs.org
Download and install the LTS version for your OS.
Then verify in your terminal:
node -v mkdir my-first-node-appcd my-first-node-app
📄 Create a file
touch app.js
✍️ Write some code
Open app.js
and add:
console.log('Hello from Node.js!');
Then run:
node app.js
✅ You should see:
Hello from Node.js!
📦 Step 3: Initialize a Project
npm init -y
This creates a package.json
— the file that manages your project dependencies and metadata.
🔥 Step 4: Create a Simple Web Server
Install Express (a popular web framework):
npm install express
Now update app.js
:
const express = require('express');const app = express();app.get('/', (req, res) => { res.send('Hello World from Express!');});app.listen(3000, () => { console.log('Server running at http://localhost:3000');});
Run it:
node app.js
Then open http://localhost:3000 in your browser. Boom! 🎉
🎯 What Next?
You can build things like:
REST APIs
File upload tools
Real-time chat apps (Socket.io)
Command-line tools
Connect to databases (MongoDB, MySQL, PostgreSQL)