17 lines
322 B
Go

package middleware
import (
"net/http"
"github.com/rs/cors"
)
// CORS middleware handles Cross-Origin Resource Sharing
func CORS(options cors.Options) Middleware {
// Create a CORS handler with the provided options
c := cors.New(options)
return func(next http.Handler) http.Handler {
return c.Handler(next)
}
}