Vanilla Node (Raw HTTP)
A minimal HTTP server using Node's native module. Routing, headers, and serialization are handled manually. This exposes the raw execution model and its limitations as complexity grows.
import http from "http";
const server = http.createServer((req, res) => {
if (req.url === "/users" && req.method === "GET") {
res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify([{ id: 1, name: "Camilo" }]));
} else {
res.writeHead(404);
res.end();
}
});
server.listen(3000);✅ Good Practices
- Exposes how HTTP actually works beneath frameworks.
❌ Anti-Patterns
- Manual routing and response handling become unmanageable as endpoints grow.
🧠 Decision
Use raw Node only when minimal control is required or for learning core runtime behavior.
📈 Scale Impact
Complexity grows linearly with routes; no structural boundaries.
⚖ Consistency Model
Single-threaded request handling via event loop.
🏗 Infrastructure Impact
Lightweight, but lacks structured middleware or error boundaries.
🔥 Failure Mode
Error handling must be manually implemented per route.