mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 05:13:01 +03:00
19 lines
355 B
Go
19 lines
355 B
Go
|
|
package middleware
|
||
|
|
|
||
|
|
import (
|
||
|
|
"golang-rest-api-template/internal/common"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"github.com/gin-contrib/cors"
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
func Cors() gin.HandlerFunc {
|
||
|
|
return cors.New(cors.Config{
|
||
|
|
AllowOrigins: []string{common.EnvConfig.AppURL},
|
||
|
|
AllowMethods: []string{"*"},
|
||
|
|
AllowHeaders: []string{"*"},
|
||
|
|
MaxAge: 12 * time.Hour,
|
||
|
|
})
|
||
|
|
}
|