Preventing Abuse
Rate limiting protects your microservice from brute-force attacks or buggy clients.
Using x/time/rate:
Go's official sub-repository provides a Token Bucket rate limiter. go limiter := rate.NewLimiter(1, 5) // 1 request per sec, burst of 5
if !limiter.Allow() { http.Error(w, "Too Many Requests", 429) return }