fso/projects

← back to all projects

Raw Node.js HTTP Server

Part 3 — Express + MongoDB

Why This Project

FSO jumps straight into Express without showing what Express abstracts away. Building a server with only Node's built-in http module gives you an appreciation for routing, request parsing, response headers, and content types. This is the "do it the hard way once" project. It's short — a day or two — but it permanently changes how you understand Express.

What to Build

A URL shortener API using only node:http — no Express, no frameworks. POST a long URL, get back a short code. GET the short code, get redirected. Store mappings in a JSON file on disk. Track how many times each short link has been visited. Serve a basic HTML page at the root that shows all shortened URLs and their click counts.

Requirements

Skills Practiced

Node.js core modules HTTP protocol request/response cycle manual routing streams file I/O status codes redirects

Pain Point to Notice

The manual URL parsing and if/else routing gets messy fast. Parsing the request body requires collecting chunks from a stream. There's no req.body, no app.get(), no middleware. After this project, you'll understand every convenience Express gives you.

Resources