You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
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) |
|
}
|
|
|