From a635513d66fd4d2c605a0e64b4fa94828c64610e Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sun, 10 May 2020 16:33:00 -0700 Subject: linked backend and frontend --- backend/api/routes.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'backend/api/routes.go') diff --git a/backend/api/routes.go b/backend/api/routes.go index a65c886..07bea5a 100644 --- a/backend/api/routes.go +++ b/backend/api/routes.go @@ -18,6 +18,10 @@ func healthCheckFunc(w http.ResponseWriter, r *http.Request) { } func insertFunc(w http.ResponseWriter, r *http.Request) { + + // Allow CORS + w.Header().Set("Access-Control-Allow-Origin", "*") + // get content _ = r.ParseMultipartForm(0) expiry := r.FormValue("expiry") @@ -38,6 +42,10 @@ func insertFunc(w http.ResponseWriter, r *http.Request) { } func getHashFunc(w http.ResponseWriter, r *http.Request) { + + // Allow CORS + w.Header().Set("Access-Control-Allow-Origin", "*") + hash := mux.Vars(r)["hash"] paste, err := cache.C.Get(hash) -- cgit v1.2.3