Node.js HTTP and Streams Cheat Sheet
A 2-page reference for HTTP servers and streams in Node.js: 13 short entries with copy-ready code.
ForDevelopers
// A minimal HTTP server
import http from "node:http";
http.createServer((req, res) => {
res.writeHead(200, { "content-type": "text/plain" });
res.end("ok");
}).listen(3000);
// Route by method and path
const server = http.createServer((req, res) => {
const url = new URL(req.url, "http://localhost");
if (req.method === "GET" && url.pathname === "/health") return res.end("ok");
res.statusCode = 404;
res.end("not found");
});
// Read a JSON request body
async function readJson(req) {
const chunks = [];What's inside
- Format
- PDF, Markdown
- Contents
- 13 sections · 2 pages
- Version
- 1.0 · Updated 3 Oct 2026
- Licence
- Commercial What this means
- Checked
- Checked before it ships
- nodejs-http-and-streams-cheat-sheet.pdfPDF · 21 KB
- nodejs-http-and-streams-cheat-sheet.mdMarkdown · 3 KB
- LICENSE.txtadded to every download
About this item
A compact, printable reference for HTTP servers and streams in Node.js. Each of the 13 entries has a one-line explanation and a small example you can paste into your editor. The PDF uses a two-column A4 layout designed to sit next to your keyboard, and the same content ships as Markdown so you can search it or drop it into your notes. Every JavaScript example targets Node 20.
- Node.js
- Server
- Streams
- HTTP
- Cheat sheet
Reviews
No reviews yet.