Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

🚀 Getting Started with Node.js – from “What is this?” to your first web server

Node.js lets us run JavaScript outside the browser. In this guide, we’ll install Node, learn the terminal, explore npm, build a real web server, understand event-driven programming, and serve static files — all before jumping into Exp…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Node.js lets us run JavaScript outside the browser. In this guide, we’ll install Node, learn the terminal, explore npm, build a real web server, understand event-driven programming, and serve static files — all before jumping into Express.js 🔥









🧠 Why Node.js feels magical



In the previous article, we mentioned that JavaScript was designed to run only in browsers. Then Node.js came along, and suddenly everyone was like, “Hold on… JavaScript can run on servers too?!”



Until then, JavaScript meant:




  • button clicks

  • animations

  • form validation

  • frontend headaches 😅



But with Node.js, suddenly JavaScript could:




  • read files

  • create APIs

  • talk to databases

  • stream videos

  • run backend servers



In this article, I’ll walk you through the exact beginner path I wish someone had shown me earlier.



By the end, you’ll:



✅ Install Node.js

✅ Understand the terminal without fear

✅ Learn npm properly

✅ Build your own Node server

✅ Understand routing

✅ Serve HTML/CSS files

✅ Be fully ready for Express.js







📌 Prerequisites



You only need:




  • Basic JavaScript knowledge

  • A laptop 🙂

  • Node.js v20+ recommended

  • ☕ Coffee (strongly recommended)







🌍 What Exactly is Node.js?



Node.js is a JavaScript runtime built on Chrome’s V8 engine.



That means:




It allows JavaScript to run outside the browser.




Instead of running only inside Chrome or Firefox, JavaScript can now run directly on your computer or server.







📊 Browser JavaScript vs Node.js



Browser Javascript Vs Node.js







💻 Getting Node.js





🟢 Step 1: Download Node



Visit:





Download the LTS version.




💡 Production note: Always prefer the LTS (Long Term Support) version for stability.








🟢 Step 2: Verify Installation



Open terminal and run:




node -v






Example output:




v20.11.0






Now check npm:




npm -v






Example:




10.2.4






Boom 💥 Node installed successfully.









🖥️ Using the Terminal



We all were scared of it initially 😄



Most beginners avoid the terminal initially.



I did too.



Huge mistake.



The terminal is basically your direct communication line with the operating system.



Think of it like this:
























GUI Terminal
Clicking buttons Typing commands
Slower Faster
Beginner friendly Developer powerful








📂 Essential Terminal Commands






Windows



Use:




  • PowerShell

  • Windows Terminal






macOS/Linux



Use:




  • Terminal app









📌 Most Useful Commands






# Show current folder
pwd

# List files
ls

# Change folder
cd folder-name

# Create folder
mkdir my-project

# Create file
touch app.js












📊 Terminal Workflow



Terminal workflow









🛠️ Editors (VS Code or Claude)



You technically can write Node code in Notepad.



But please don’t torture yourself 😭.









🟦 VS Code (Recommended)



Visual Studio Code



Why developers love it:




  • Fast

  • Free

  • Great extensions

  • Git integration

  • Built-in terminal

  • Excellent Node support









🔌 Extensions I Recommend




























Extension Why
ESLint Catch JavaScript mistakes
Prettier Auto formatting
Thunder Client API testing
GitLens Git superpowers








🤖 Claude Editor



Many developers also use:





Especially for:




  • debugging help

  • refactoring

  • documentation generation

  • learning concepts faster

  • vibe coding (We'll discuss this in detail in future articles)



But honestly?



VS Code + Node is still the gold standard for most beginners.









📦 Understanding npm



npm stands for:




Node Package Manager




This is where Node becomes insanely powerful.



npm lets you install reusable packages instead of reinventing the wheel every time.









🧱 Create Your First Project






mkdir node-demo
cd node-demo






Initialize project:




npm init -y






This creates:




package.json












📄 What is package.json?



Think of it like:




The Aadhaar card or identity card of your project 😄




It contains:




  • project name

  • dependencies

  • scripts

  • version

  • metadata









📌 Example package.json






{
"name": "node-demo",
"version": "1.0.0",
"main": "app.js"
}












📊 How npm Works



NPM workflow









🚀 A Simple Web Server with Node.js



Now the fun part begins 🔥









👋 Hello World Server



Create:




app.js












✅ Minimal Node Server






// Node.js v20

// Import Node's built-in HTTP module
const http = require('http');

// Create server
const server = http.createServer((request, response) => {

// Send HTTP status code
response.writeHead(200, {
'Content-Type': 'text/plain'
});

// Send response body
response.end('Hello World from Node.js 🚀');
});

// Start listening on port 3000
server.listen(3000, () => {

// Callback runs once server starts
console.log('Server running at http://localhost:3000');

});












▶️ Run the Server






node app.js






Visit:




http://localhost:3000






And there it is 🎉



Your first Node web server.









⚡ Understanding Event-Driven Programming



This is THE core Node concept.



And honestly?



This is where many folks get confused initially.









🧠 Traditional Programming



Traditional systems often wait for one task to finish before moving to the next.



Like standing in a railway booking queue 🚉.



One person at a time.









🚀 Node’s Event-Driven Model



Node works differently.



Instead of blocking everything:




  • it listens for events

  • processes callbacks

  • handles async tasks efficiently









📊 Event Loop Explained



Event loop diagram









📌 Simple Event Example






// Node.js Events Module

const EventEmitter = require('events');

// Create event emitter instance
const emitter = new EventEmitter();

// Listen for custom event
emitter.on('orderPlaced', () => {

console.log('🍕 Pizza order received');

});

// Emit event
emitter.emit('orderPlaced');






Output:




🍕 Pizza order received












🧭 Routing in Node.js



Routing means:




Sending different responses for different URLs.




Example:
























URL Response
/ Home page
/about About page
/contact Contact page








✅ Basic Routing Example






// app.js

const http = require('http');

const server = http.createServer((req, res) => {

// Homepage route
if (req.url === '/') {

res.writeHead(200, {
'Content-Type': 'text/plain'
});

res.end('🏠 Welcome Home');

}

// About page route
else if (req.url === '/about') {

res.writeHead(200, {
'Content-Type': 'text/plain'
});

res.end('ℹ️ About Us');

}

// Fallback route
else {

res.writeHead(404, {
'Content-Type': 'text/plain'
});

res.end('❌ Page Not Found');

}

});

// Start server
server.listen(3000, () => {
console.log('Server started');
});












📊 How Routing Works



Routing workflow









📂 Serving Static Resources



Static resources include:




  • HTML

  • CSS

  • JavaScript

  • Images



Without this, websites would look like 1998 😅.









📁 Project Structure






project/

├── app.js
├── public/
│ ├── index.html
│ └── style.css












✅ Serve HTML File






// Node.js v20

const http = require('http');
const fs = require('fs');

const server = http.createServer((req, res) => {

// Read HTML file
fs.readFile('./public/index.html', (error, data) => {

// Handle file read errors
if (error) {

res.writeHead(500);

res.end('Internal Server Error');

return;
}

// Send HTML response
res.writeHead(200, {
'Content-Type': 'text/html'
});

res.end(data);

});

});

server.listen(3000);












📄 Example HTML






<!DOCTYPE html>
<html>

<head>
<title>Node Demo</title>
</head>

<body>

<h1>🚀 Node.js Server</h1>

</body>
</html>












🎨 Serve CSS File






// Simplified CSS serving example

if (req.url === '/style.css') {

fs.readFile('./public/style.css', (err, data) => {

res.writeHead(200, {
'Content-Type': 'text/css'
});

res.end(data);

});

}












🤯 What Broke When I Tried This



TBH, many things 😂









❌ Mistake 1: Wrong File Path






ENOENT: no such file or directory









✅ Fix



Always verify folder structure carefully.









❌ Mistake 2: Port Already in Use






EADDRINUSE









✅ Fix



Another app is using the same port.



Simply, change the port number. (3000 to something else which is not getting used 😄)









❌ Mistake 3: Browser Keeps Loading Forever



Usually happens because:




res.end()






was forgotten.









📈 Why Express.js Was Needed



After writing enough raw Node servers, developers realized:




“Dude… this is becoming repetitive.”




Things became messy quickly:




  • manual routing

  • manual headers

  • repetitive file handling

  • middleware chaos



That’s exactly why Express.js became popular.









📊 Raw Node vs Express



Node vs Express



Express dramatically reduced boilerplate code.









☕ Caffeine Scale




























Topic Complexity
Installing Node
npm basics ☕☕
Routing ☕☕
Event loop ☕☕☕☕








🎯 Onward to Express.js



Now you understand:



✅ Node installation

✅ Terminal basics

✅ npm

✅ HTTP servers

✅ Event-driven programming

✅ Routing

✅ Static files



You’re officially ready for:






🚀 Express.js



But don’t worry — if you missed anything, we’ll come back to some of these topics individually and go way deeper 🚀



And trust me…



Once you use Express routing after raw Node routing, it feels like upgrading from manual gear driving to automatic 😄









📌 Key Takeaways




  • Node.js lets JavaScript run outside browsers

  • npm powers the massive Node ecosystem

  • Node uses event-driven architecture

  • You can build web servers with built-in modules

  • Routing and static file serving are fundamental backend concepts

  • Express simplifies all of this beautifully









📢 What’s Next?



In the next article we’ll cover:




  • Scaffolding

  • Installing Express

  • Request/response lifecycle

  • Middleware









💬 Your Turn



What confused you most when learning Node?




  • npm?

  • terminal?

  • async programming?

  • routing?



And did you also use incorrect file path at least once? 😅









📣 Call To Action



If this article helped you:




  • ⭐ Bookmark it

  • 🔁 Share with a beginner developer

  • 🚀 Build your own tiny Node server today

  • 👨‍💻 Follow for more backend deep dives

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 🚀 Getting Started with Node.js – from “What is this?” to your first web server

Thematisch verwandte Begriffe: Getting, Started, with, Nodejs · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-79918 | MaxKB is an open-source AI assistant for enterprise. Prior to version 2.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick