Skip to content

Commit

Permalink
feat: cors
Browse files Browse the repository at this point in the history
  • Loading branch information
mindrunner committed Sep 3, 2024
1 parent 2248a41 commit 385f3cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apiService.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import (
func APIService(c ClustersToRun) {
runCluster := func(mode ConnectionMode, host string, hostSSL string, key string, crt string) {
router := gin.Default()
router.Use(cors.New(cors.Config{
AllowOrigins: []string{"https://explorer.atlasnet.staratlas.cloud"},
AllowMethods: []string{"GET"},
AllowHeaders: []string{"Origin"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}))
router.GET("/:cluster/latest", getLatest)
router.GET("/:cluster/last6hours", timeout.New(timeout.WithTimeout(10*time.Second), timeout.WithHandler(last6hours)))
router.GET("/:cluster/last6hours/nocomputeprice", timeout.New(timeout.WithTimeout(10*time.Second), timeout.WithHandler(last6hoursNoPrice)))
Expand Down

0 comments on commit 385f3cb

Please sign in to comment.