first commit

This commit is contained in:
2020-08-14 10:21:12 +08:00
parent 5c00a2534b
commit 4ac29d32e0
8 changed files with 41 additions and 2 deletions
+3 -1
View File
@@ -2,6 +2,7 @@ package rest
import (
"fmt"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"nbarest/lib/persistence"
"net/http"
@@ -16,6 +17,7 @@ func ServeAPI(endpoint string,dbhandler persistence.DatabaseHandler) error{
playersrouter.Path("/").HandlerFunc(handler.FindAllPlayerHandler).Methods("GET")
playersrouter.Path("/").HandlerFunc(handler.NewPlayerHandler).Methods("POST")
fmt.Println("listen")
return http.ListenAndServe(endpoint,r)
server := handlers.CORS()(r)
return http.ListenAndServe(endpoint, server)
}