frontend: add CORS header to API

This commit is contained in:
Lan Tian
2021-01-17 12:45:20 +08:00
parent 472cec74b0
commit e2cc580da3

View File

@@ -107,6 +107,7 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
}
w.Header().Add("Content-Type", "application/json")
w.Header().Add("Access-Control-Allow-Origin", "*")
bytes, err := json.Marshal(response)
if err != nil {
println(err.Error())