khatru-pyramid/handler.go

21 lines
544 B
Go
Raw Normal View History

2023-09-06 20:49:18 +02:00
package main
import (
"encoding/json"
"net/http"
)
func inviteDataApiHandler(w http.ResponseWriter, re *http.Request) {
jsonBytes, err := json.Marshal(whitelist)
if err != nil {
http.Error(w, "internal server error", http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(http.StatusOK)
if _, err := w.Write(jsonBytes); err != nil {
http.Error(w, "internal server error", http.StatusInternalServerError)
}
}