diff --git a/internal/api/handlers/helpers.go b/internal/api/handlers/helpers.go new file mode 100644 index 0000000..2341969 --- /dev/null +++ b/internal/api/handlers/helpers.go @@ -0,0 +1,12 @@ +package handlers + +import ( + "encoding/json" + "net/http" +) + +func respond(w http.ResponseWriter, status int, data any) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(status) + json.NewEncoder(w).Encode(data) +}