Changelog 0.3.0

This commit is contained in:
Mukhtar Akere
2024-11-30 15:46:58 +01:00
parent df2aa4e361
commit a51364d150
53 changed files with 2019 additions and 679 deletions

View File

@@ -2,6 +2,7 @@ package common
import (
"crypto/tls"
"encoding/json"
"fmt"
"golang.org/x/time/rate"
"io"
@@ -125,3 +126,9 @@ func ParseRateLimit(rateStr string) *rate.Limiter {
return nil
}
}
func JSONResponse(w http.ResponseWriter, data interface{}, code int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(data)
}