cors.go 273 B

123456789101112
  1. package middleware
  2. import (
  3. "github.com/gin-contrib/cors"
  4. "github.com/gin-gonic/gin"
  5. )
  6. func CORS() gin.HandlerFunc {
  7. config := cors.DefaultConfig()
  8. config.AllowOrigins = []string{"https://gin-template.vercel.app", "http://localhost:3000/"}
  9. return cors.New(config)
  10. }