package handler import ( "encoding/json" "net/http" "time" ) func writeJSON(w http.ResponseWriter, status int, data any) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) json.NewEncoder(w).Encode(data) } func writeError(w http.ResponseWriter, status int, message string) { writeJSON(w, status, map[string]any{ "success": false, "error": map[string]any{ "statusCode": status, "message": message, "timestamp": time.Now().UTC().Format(time.RFC3339), }, }) }