meteran / gnext

Web Framework extension for Gin. Offers the API structuring, automates validation and generates documentation. It's fully compatible with the current Gin usages and Gin's middlewares.
https://pkg.go.dev/github.com/meteran/gnext
MIT License
69 stars 5 forks source link

CORS Issue #17

Closed akhilgupta1093 closed 1 year ago

akhilgupta1093 commented 1 year ago

How can we resolve a CORS issue?

kruczekrobert commented 1 year ago

What exactly do you mean?

meteran commented 1 year ago

Hi @akhilgupta1093, for now we don't have a dedicated middleware for this purpose yet. But the framework is compatible with native gin middlewares, so you can use e.g. github.com/gin-contrib/cors library:

router := gnext.Router()

corsConfig := cors.DefaultConfig()
corsConfig.AllowCredentials = true
corsConfig.AllowAllOrigins = true
corsConfig.AddAllowHeaders("Authorization")

router.Engine().Use(cors.New(corsConfig))
kruczekrobert commented 1 year ago

@akhilgupta1093 Does the problem still exist?

akhilgupta1093 commented 1 year ago

Hi, not for this reason, but I decided not to use this library. Seems like the standard gin middleware should fix the issue, thanks.