Add different cors config
This commit is contained in:
parent
a675d51718
commit
505faa95a3
@ -506,9 +506,11 @@ func start(ctx context.Context, config *ServerConfig) {
|
|||||||
defer db.db.MustClose()
|
defer db.db.MustClose()
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
router.Use(cors.New(cors.Config{
|
|
||||||
AllowOrigins: []string{"*"},
|
corsConfig := cors.DefaultConfig()
|
||||||
}))
|
corsConfig.AllowAllOrigins = true
|
||||||
|
router.Use(cors.New(corsConfig))
|
||||||
|
|
||||||
router.GET("/api/users", getUsers)
|
router.GET("/api/users", getUsers)
|
||||||
router.GET("/api/user/:userId", getUser)
|
router.GET("/api/user/:userId", getUser)
|
||||||
router.POST("/api/user/:userId/history", postHistory)
|
router.POST("/api/user/:userId/history", postHistory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user