Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
A real service uses a framework, not the raw socket. Every language has its workhorse: Go's net/http, Python's FastAPI, Rust's Axum or Actix, Node's Express or Fastify. They all do the same thing — route HTTP requests to your handlers — but they make different tradeoffs on performance, ergonomics, and memory. Learning the minimum-viable server in each is a 15-minute exercise per language, and it calibrates your sense of what 'fast' and 'simple' mean in each ecosystem.
Every production service registers at least two routes: a root and a health check. Building both in Go's net/http, Python's FastAPI, Rust's Axum, and Node's Express simultaneously reveals how each ecosystem handles routing, response types, and JSON serialisation — and which language makes the simplest things simplest. The structural differences are small; the ergonomic differences matter after you've written the same route fifty times.
/ and /health server running. Curl both.curl -w 'time=%{time_total}\n' -o /dev/null -s http://localhost:8080/ and note the response time for each language. Surprising?Use these three in order. Each builds on the one before.
Compare Go's `net/http`, Python's FastAPI, Rust's Axum, and Node's Express. What's each one's core philosophy? When should I reach for which?
FastAPI is built on Starlette and Uvicorn. Axum is built on Tokio and Hyper. Express runs on Node's libuv. Explain what each layer does — the HTTP parsing, the async runtime, the I/O multiplexing — and where the framework-specific code actually lives.
For a service handling 50k rps with sub-10ms p99 latency, which framework would you pick and why? Where are the bottlenecks in each (parsing, allocation, context switching)? Are the differences real or 'it doesn't matter, write clear code'?
package main
import (
"encoding/json"
"net/http"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello from go\n"))
})
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
})
http.ListenAndServe(":8080", mux)
}go run main.go