CORS middleware for Go.
go get -u github.com/go-http-utils/cors
API documentation can be found here: https://godoc.org/github.com/go-http-utils/cors
import (
"github.com/go-http-utils/cors"
)
mux := http.NewServeMux()
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
res.Write([]byte("Hello World"))
})
http.ListenAndServe(":8080", cors.Handler(mux))