(next http.Handler)
| 100 | } |
| 101 | |
| 102 | func cors(next http.Handler) http.Handler { |
| 103 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 104 | w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") |
| 105 | w.Header().Set("Access-Control-Allow-Origin", "*") |
| 106 | next.ServeHTTP(w, r) |
| 107 | }) |
| 108 | } |
| 109 | |
| 110 | func startHTTPServer(inputChan chan string) { |
| 111 | handleSubmit := func(w http.ResponseWriter, r *http.Request) { |