CORS Basic Middleware for Gin Gonic
$ go get github.com/afboteros/gin-cors
import (
"github.com/gin-gonic/gin"
"github.com/afboteros/gin-cors"
)
func main() {
g := gin.New()
g.Use(cors.Middleware(cors.Options{}))
}
When working with AngularJS ngResource, Options method will return error with some libraries, due to status return on this method
if c.Request.Method == Options {
c.AbortWithStatus(http.StatusNoContent)
}