mirror of
https://github.com/arnaucube/gogame.git
synced 2026-02-06 19:16:40 +01:00
update cors to allow gogame-frontend requests
This commit is contained in:
@@ -3,3 +3,5 @@
|
||||
Nostalgic OGame clone in Go
|
||||
|
||||
WIP
|
||||
|
||||
The frontend is in https://github.com/arnaucube/gogame-frontend
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user