#net-http Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Go HTTP Middleware (Decorator Pattern)
Middleware in Go is `func(http.Handler) http.Handler`. Wrap a handler with logging, auth, recovery, CORS, or rate limiting — chain them together for a real middleware stack.
Go Minimal net/http Server
The standard library ships a production-quality HTTP server. `http.HandleFunc` registers a function; `http.ListenAndServe` blocks forever serving requests.
Go JSON API Endpoint
Decode an incoming JSON body into a typed struct, do work, encode a JSON response. The whole roundtrip is ~20 lines of standard library.