package Utils import ( "encoding/json" "net/http" ) func RespondJSON(data interface{}, code int, writer http.ResponseWriter) { writer.Header().Add("Content-type", "application/json") writer.WriteHeader(code) json.NewEncoder(writer).Encode(data) }