Initial proof-of-concept

This commit is contained in:
Michael Mayer
2018-02-04 17:34:07 +01:00
parent ae91906416
commit c8b7dbbe01
26 changed files with 1433 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package main
import (
"encoding/json"
"net/http"
)
func responseError(w http.ResponseWriter, message string, code int) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
json.NewEncoder(w).Encode(map[string]string{"error": message})
}
func responseJSON(w http.ResponseWriter, data interface{}) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
}