diff --git a/README.md b/README.md index daf797e..9994a82 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,5 @@ Nostalgic OGame clone in Go WIP + +The frontend is in https://github.com/arnaucube/gogame-frontend diff --git a/endpoint/handlers.go b/endpoint/handlers.go index a5cd981..9f1bb8c 100644 --- a/endpoint/handlers.go +++ b/endpoint/handlers.go @@ -27,9 +27,9 @@ func handleInfo(c *gin.Context) { } type RegisterMsg struct { - Name string `binding:"required"` - Password string `binding:"required"` - Email string `binding:"required"` + Name string `json:"name" binding:"required"` + Password string `json:"password" binding:"required"` + Email string `json:"email" binding:"required"` } func handleRegister(c *gin.Context) { diff --git a/endpoint/serve.go b/endpoint/serve.go index 0f6a198..6f638d1 100644 --- a/endpoint/serve.go +++ b/endpoint/serve.go @@ -23,7 +23,13 @@ var gameservice *gamesrv.Service func newApiService() *gin.Engine { api := gin.Default() - api.Use(cors.Default()) + api.Use(cors.New(cors.Config{ + AllowOrigins: []string{"http://127.0.0.1:8080"}, + AllowMethods: []string{"GET", "POST"}, + AllowHeaders: []string{"Authorization", "Content-Type"}, + AllowCredentials: true, + MaxAge: 12 * time.Hour, + })) // the jwt middleware authMiddleware, err := jwt.New(&jwt.GinJWTMiddleware{