diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/main.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/backend/main.go b/backend/main.go index f5c754c..429dd37 100644 --- a/backend/main.go +++ b/backend/main.go @@ -7,6 +7,8 @@ import ( ) func helloHandler(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Content-Type", "application/json") w.Write([]byte("Hello, World!")) } @@ -20,10 +22,5 @@ func requestServer() { func main() { http.HandleFunc("/", helloHandler) - go func() { - err := http.ListenAndServe(":8080", nil) - fmt.Println(err) // don't ignore errors - }() - - requestServer() + http.ListenAndServe(":8080", nil) } |
